Guest User

Hierarchical argparse: commands only in parent help message

a guest
Jul 2nd, 2019
352
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.83 KB | None | 0 0
  1. >>> parser.print_help()
  2. usage: -c [-h] {extra-action,create,update} ...
  3. positional arguments:
  4.   {extra-action,create,update}
  5.                         Desired action to perform
  6.     extra-action        Do something without db
  7.     create              Create something
  8.     update              Update something
  9. optional arguments:
  10.   -h, --help            show this help message and exit
  11.  
  12.  
  13. >>> parser_create.print_help()
  14. usage: -c create [-h] -p P
  15. optional arguments:
  16.   -h, --help  show this help message and exit
  17.   -p P        add db parameter
  18.  
  19.  
  20. >>> parser_update.print_help()
  21. usage: -c update [-h] -p P
  22. optional arguments:
  23.   -h, --help  show this help message and exit
  24.   -p P        add db parameter
  25.  
  26.  
  27. >>> parser_other.print_help()
  28. usage: -c extra-action [-h]
  29. optional arguments:
  30.   -h, --help  show this help message and exit
Add Comment
Please, Sign In to add comment