Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,18 @@ def get_start_date(watson, output):
return watson.frames[frame_id].start.format('YYYY-MM-DD HH:mm:ss')


# watson help

@pytest.mark.parametrize('cmd_name', ['add', 'start', 'stop'])
def test_show_command_help(runner, watson, cmd_name):
result = runner.invoke(
cli.help,
[cmd_name],
obj=watson)
assert result.exit_code == 0
assert result.output.startswith('Usage: ' + cmd_name)


# watson add

@pytest.mark.parametrize('test_dt,expected', VALID_DATES_DATA)
Expand Down
5 changes: 4 additions & 1 deletion watson/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,10 @@ def help(ctx, command):
if not cmd:
raise click.ClickException(u"No such command: {}".format(command))

click.echo(cmd.get_help(ctx))
# the passed context is that of the 'help' command, which would
# show up in the Usage: ... - message. Create the proper context:
cmd_context = click.Context(cmd, parent=ctx.parent, info_name=cmd.name)
click.echo(cmd.get_help(cmd_context))


def _start(watson, project, tags, restart=False, gap=True):
Expand Down