Improve suggestions - add explicit SuggestFor attribute

This commit is contained in:
Fabiano Franz
2015-09-25 12:04:28 -03:00
parent 3afa4db2c6
commit a83a172122
3 changed files with 29 additions and 6 deletions

View File

@ -442,6 +442,18 @@ or
command.SuggestionsMinimumDistance = 1
You can also explicitly set names for which a given command will be suggested using the `SuggestFor` attribute. This allows suggestions for strings that are not close in terms of string distance, but makes sense in your set of commands and for some which you don't want aliases. Example:
```
$ hugo delete
unknown command "delete" for "hugo"
Did you mean this?
remove
Run 'hugo --help' for usage.
```
## Generating markdown formatted documentation for your command
Cobra can generate a markdown formatted document based on the subcommands, flags, etc. A simple example of how to do this for your command can be found in [Markdown Docs](md_docs.md)