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
from commandr import command, Run | |
@command('greet') | |
def Hi(name, title='Mr.', times=1): | |
'''Greet someone. | |
Arguments: | |
name - Name to greet. | |
title - Title of the person to greet. | |
times - Number of times to say the greeting. ''' | |
greeting = 'Hi %s %s!' % (title, name) |
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: |
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
$ pip install commandr |