Skip to content

Commit

Permalink
Merge pull request #34 from sloria/didyoumean
Browse files Browse the repository at this point in the history
Add "Did you mean..." functionality
  • Loading branch information
sloria committed May 9, 2018
2 parents 5eea895 + d0fb4be commit 8c7dd7f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
3 changes: 2 additions & 1 deletion doitlive/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from click import echo as click_echo
from click import style, secho, getchar
from click.termui import strip_ansi
from click_didyoumean import DYMGroup
import click
import click_completion

Expand Down Expand Up @@ -612,7 +613,7 @@ def run(commands, shell=None, prompt_template='default', speed=1,
# #######

@click.version_option(__version__, '--version', '-v')
@click.group(context_settings={'help_option_names': ('-h', '--help')})
@click.group(cls=DYMGroup, context_settings={'help_option_names': ('-h', '--help')})
def cli():
"""doitlive: A tool for "live" presentations in the terminal
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
REQUIRES = [
'click>=4.0',
'click-completion>=0.3.1',
'click-didyoumean>=0.0.3',
]

if 'win32' in str(sys.platform).lower():
Expand Down
7 changes: 7 additions & 0 deletions tests/test_doitlive.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,13 @@ def test_bad_format_prompt():
doitlive.format_prompt('{notfound}')


def test_did_you_mean(runner):
result = runner.invoke(cli, ['the'])
assert result.exit_code > 0
assert 'Did you mean' in result.output
assert 'themes' in result.output


@pytest.mark.skipif(not git_available, reason='Git is not available')
def test_get_git_branch(runner):
with runner.isolated_filesystem():
Expand Down

0 comments on commit 8c7dd7f

Please sign in to comment.