Created
May 22, 2013 22:10
-
-
Save kevinballard/5631361 to your computer and use it in GitHub Desktop.
Example interaction with commandr.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ python example.py | |
> Command must be specified | |
> | |
> General Commands: | |
> greet | |
$ python example.py greet | |
> All options without default values must be specified | |
> | |
> Current Options: | |
> --name=None | |
> --title=Mr. | |
> --times=1 | |
> | |
> Documentation for command 'greet': | |
> ---------------------------------------- | |
> Greet someone. | |
> Arguments: | |
> name - Name to greet. | |
> title - Title of the person to greet. | |
> times - Number of times to say the greeting. | |
> ---------------------------------------- | |
> | |
> Usage: example.py command [options] | |
> Options without default values MUST be specified | |
> | |
> Options: | |
> -h, --help | |
> -n NAME, --name=NAME | |
> -t TITLE, --title=TITLE | |
> [default: "Mr."] | |
> --times=TIMES [default: 1] | |
$ python example.py greet --name Smith | |
> Hi Mr. Smith! | |
$ python example.py greet John --times blah | |
> Usage: example.py command [options] | |
> Options without default values MUST be specified | |
> | |
> example.py: error: option --times: invalid integer value: 'blah' | |
$ python example.py greet Nick Dr. --times 2 | |
> Hi Dr. Nick! | |
> Hi Dr. Nick! | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment