Browse Source

add subcommands to argument parsing

john melesky 7 years ago
parent
commit
f658914aa8
1 changed files with 19 additions and 3 deletions
  1. 19 3
      punt

+ 19 - 3
punt

@@ -31,9 +31,25 @@ def run(bottle, exe):
 
 if __name__ == '__main__':
     parser = argparse.ArgumentParser(description="Command-line tool for using and manipulating wine 'bottle's")
-    parser.add_argument('command', choices=['install', 'run', 'list', 'delete'])
-    parser.add_argument('bottle', help="the name of the bottle")
-    parser.add_argument('app', help="the path to the windows executable to run")
+    parser.add_argument('--dry-run', action='store_true',
+                        help='Plan and display the execution steps, but do not actually perform any changes')
+    parser.add_argument('--verbose', '-v', action='count',
+                        help='Verbose mode (additional v\'s increase verbosity)')
+    parser.add_argument('--quiet', '-q', action='store_true',
+                        help='Quiet mode -- suppress output')
+
+    subparsers = parser.add_subparsers()
+
+    parser_install = subparsers.add_parser('install', help='Run an program that installs software')
+    parser_install.add_argument('bottle', help="the name of the bottle")
+    parser_install.add_argument('app', help="the path to the windows installer to run")
+
+    parser_list = subparsers.add_parser('list', help='List all bottles managed by punt')
+
+    parser_run = subparsers.add_parser('run', help='Run an installed app')
+
+    parser_delete = subparsers.add_parser('delete', help='Delete a specific bottle')
+
     args = parser.parse_args()
 
     run(args.bottle, args.app)