Complex Example
Simplified example of a complex set of Commands defined across multiple modules.
The expected / intended use case would be for a program that would define an entry point like the following:
complex_example.py = examples.complex:main
Any number of additional modules could be used, as long as they are imported in the package’s __init__.py
with the
base Command so that the base Command is made aware of the presence of the subcommands.
- author:
Doug Skrypa
usage: complex_example.py {hello|logs|update} [--verbose [VERBOSE]] [--help]
Subcommands
|
|
|
|
|
Optional arguments
|
Increase logging verbosity (can specify multiple times) |
|
Show this help message and exit |
Subcommands
Subcommand: hello
usage: complex_example.py hello [--verbose [VERBOSE]] [--help] [--name NAME]
Optional arguments
|
Increase logging verbosity (can specify multiple times) |
|
Show this help message and exit |
|
The person to say hello to (default: |
Subcommand: logs
usage: complex_example.py logs [--verbose [VERBOSE]] [--help]
Optional arguments
|
Increase logging verbosity (can specify multiple times) |
|
Show this help message and exit |
Subcommand: update
usage: complex_example.py update {foo|bar|user|group} [--verbose [VERBOSE]] [--help] [--dry-run] [--ids ID [ID ...]] [--all] [--name NAME] [--description DESCRIPTION]
Subcommands
|
|
|
|
|
|
|
Optional arguments
|
Increase logging verbosity (can specify multiple times) |
|
Show this help message and exit |
|
Print the actions that would be taken instead of taking them |
Common Fields options
|
The new name for the specified item(s) |
|
The new description to use for the specified item(s) |
Mutually exclusive options
|
The IDs of the item to update |
|
Update all items |
Subcommand: update foo
usage: complex_example.py update foo {foo|bar|user|group} [--verbose [VERBOSE]] [--help] [--dry-run] [--ids ID [ID ...]] [--all] [--name NAME] [--description DESCRIPTION]
Subcommands
|
|
|
|
|
|
|
Optional arguments
|
Increase logging verbosity (can specify multiple times) |
|
Show this help message and exit |
|
Print the actions that would be taken instead of taking them |
Common Fields options
|
The new name for the specified item(s) |
|
The new description to use for the specified item(s) |
Mutually exclusive options
|
The IDs of the item to update |
|
Update all items |
Subcommand: update bar
usage: complex_example.py update bar {foo|bar|user|group} [--verbose [VERBOSE]] [--help] [--dry-run] [--ids ID [ID ...]] [--all] [--name NAME] [--description DESCRIPTION]
Subcommands
|
|
|
|
|
|
|
Optional arguments
|
Increase logging verbosity (can specify multiple times) |
|
Show this help message and exit |
|
Print the actions that would be taken instead of taking them |
Common Fields options
|
The new name for the specified item(s) |
|
The new description to use for the specified item(s) |
Mutually exclusive options
|
The IDs of the item to update |
|
Update all items |
Subcommand: update user
usage: complex_example.py update user [--verbose [VERBOSE]] [--help] [--dry-run] [--ids ID [ID ...]] [--all] [--name NAME] [--description DESCRIPTION] [--location LOCATION] [--role {admin|user}]
Optional arguments
|
Increase logging verbosity (can specify multiple times) |
|
Show this help message and exit |
|
Print the actions that would be taken instead of taking them |
|
The new location for the specified item(s) |
|
The new role for the specified user(s) |
Common Fields options
|
The new name for the specified item(s) |
|
The new description to use for the specified item(s) |
Mutually exclusive options
|
The IDs of the item to update |
|
Update all items |
Subcommand: update group
usage: complex_example.py update group [--verbose [VERBOSE]] [--help] [--dry-run] [--ids ID [ID ...]] [--all] [--name NAME] [--description DESCRIPTION] [--location LOCATION] [--add MEMBER [MEMBER ...]] [--remove MEMBER [MEMBER ...]]
Optional arguments
|
Increase logging verbosity (can specify multiple times) |
|
Show this help message and exit |
|
Print the actions that would be taken instead of taking them |
|
The new location for the specified item(s) |
|
Members to add |
|
Members to remove |
Common Fields options
|
The new name for the specified item(s) |
|
The new description to use for the specified item(s) |
Mutually exclusive options
|
The IDs of the item to update |
|
Update all items |