def test_custom_primary_command(create_project, run):
"""Test creating a command that overwrites the primary command."""
usage = '''
Usage: hello [--name <name>]
Options:
--name <name> The name to print [default: world].
'''
with create_project('''
def hello(name):
"""{usage}"""
print('Hello, {{name}}!'.format(name=name))
'''.format(usage=usage)):
assert run('hello --name everyone') == 'Hello, everyone!\n'
assert run('hello') == 'Hello, world!\n'
assert inspect.cleandoc(run('hello -h')) == inspect.cleandoc(usage)
评论列表
文章目录