From: Christoph Gysin Date: Sun, 5 Nov 2017 21:26:49 +0000 (+0200) Subject: getopt: save args X-Git-Tag: 1.3~7^2~3 X-Git-Url: https://git.donarmstrong.com/?p=deb_pkgs%2Fautorandr.git;a=commitdiff_plain;h=ed4eab647ab041a22ba25bec0a115e5f66a5a543 getopt: save args --- diff --git a/autorandr.py b/autorandr.py index bf552bc..119500b 100755 --- a/autorandr.py +++ b/autorandr.py @@ -955,13 +955,15 @@ def dispatch_call_to_sessions(argv): def main(argv): try: - options = dict(getopt.getopt(argv[1:], "s:r:l:d:cfh", ["batch", "dry-run", "change", "default=", "save=", "remove=", "load=", "force", "fingerprint", "config", "debug", "skip-options=", "help"])[0]) + opts, args = getopt.getopt(argv[1:], "s:r:l:d:cfh", ["batch", "dry-run", "change", "default=", "save=", "remove=", "load=", "force", "fingerprint", "config", "debug", "skip-options=", "help"]) except getopt.GetoptError as e: print("Failed to parse options: {0}.\n" "Use --help to get usage information.".format(str(e)), file=sys.stderr) sys.exit(posix.EX_USAGE) + options = dict(opts) + if "-h" in options or "--help" in options: exit_help()