Add suggestions support

The new option `app.Suggest` enables command and flag suggestions via
the jaro-winkler distance algorithm. Flags are scoped to their
appropriate commands whereas command suggestions are scoped to the
current command level.

Signed-off-by: Sascha Grunert <sgrunert@suse.com>
This commit is contained in:
Sascha Grunert
2019-11-29 14:09:46 +01:00
parent 1b7e4e00c7
commit 002bde2233
9 changed files with 257 additions and 8 deletions

View File

@@ -34,6 +34,7 @@ cli v2 manual
* [Version Flag](#version-flag)
+ [Customization](#customization-2)
* [Timestamp Flag](#timestamp-flag)
* [Suggestions](#suggestions)
* [Full API Example](#full-api-example)
<!-- tocstop -->
@@ -1426,6 +1427,13 @@ In this example the flag could be used like this :
Side note: quotes may be necessary around the date depending on your layout (if you have spaces for instance)
### Suggestions
To enable flag and command suggestions, set `app.Suggest = true`. If the suggest
feature is enabled, then the help output of the corresponding command will
provide an appropriate suggestion for the provided flag or subcommand if
available.
### Full API Example
**Notice**: This is a contrived (functioning) example meant strictly for API