dispatch-conf: add --help/--version flags
authorMike Frysinger <vapier@gentoo.org>
Thu, 8 Mar 2012 20:19:55 +0000 (15:19 -0500)
committerMike Frysinger <vapier@gentoo.org>
Thu, 8 Mar 2012 20:19:55 +0000 (15:19 -0500)
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
bin/dispatch-conf

index 75e991189367e559db732a6a9aa61f80a5e30a60..a77811881e4f3a2866e414b1b8e9d32abd291690 100755 (executable)
@@ -459,6 +459,19 @@ def spawn_shell(cmd):
     else:
         os.system(cmd)
 
+def usage(argv):
+    print('dispatch-conf: sane configuration file update\n')
+    print('Usage: dispatch-conf [config dirs]\n')
+    print('See the dispatch-conf(1) man page for more details')
+    sys.exit(os.EX_OK)
+
+for x in sys.argv:
+    if x in ('-h', '--help'):
+        usage(sys.argv)
+    elif x in ('--version'):
+        print("Portage", portage.VERSION)
+        sys.exit(os.EX_OK)
+
 # run
 d = dispatch ()