]> git.donarmstrong.com Git - deb_pkgs/autorandr.git/blobdiff - autorandr.py
readme: add example for short form of --load
[deb_pkgs/autorandr.git] / autorandr.py
index bf552bc9113c3f15e69e2328f1f4b46a4c4a4dbc..e5ab42fdd0308695e720b6ada0415ccdd8751c0e 100755 (executable)
@@ -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()
 
@@ -1070,6 +1072,8 @@ def main(argv):
         options["--load"] = options["-l"]
     if "--load" in options:
         load_profile = options["--load"]
+    elif len(args) == 1:
+        load_profile = args[0]
     else:
         # Find the active profile(s) first, for the block script (See #42)
         current_profiles = []