From 4a40152d5a9cf9db3d0516b0dc44b8dfc73fca8e Mon Sep 17 00:00:00 2001 From: hiiwave Date: Tue, 1 Oct 2019 21:33:25 +0800 Subject: [PATCH] Enable git-like did-you-mean feature (#318) Implement did-you mean feature thanks to https://github.com/click-contrib/click-didyoumean --- CHANGELOG.md | 1 + requirements.txt | 1 + watson/cli.py | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e1b6ba13..1068d338 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Improve Arrow 0.15.0 support after changes in `arrow.get()` behavior (#296) +- Watson now suggests correct command if users make small typo (#318) ### Fixed diff --git a/requirements.txt b/requirements.txt index b0281ab9..3239b1db 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ arrow!=0.11,!=0.12.0 click +click-didyoumean requests diff --git a/watson/cli.py b/watson/cli.py index daf368cf..fee1e907 100644 --- a/watson/cli.py +++ b/watson/cli.py @@ -12,6 +12,7 @@ import arrow import click +from click_didyoumean import DYMGroup from . import watson as _watson from .frames import Frame @@ -122,7 +123,7 @@ def wrapper(*args, **kwargs): return wrapper -@click.group() +@click.group(cls=DYMGroup) @click.version_option(version=_watson.__version__, prog_name='Watson') @click.pass_context def cli(ctx):