Introduce override hooks for suggestions

Related to https://github.com/urfave/cli/pull/1390#discussion_r871398659
This commit is contained in:
2022-05-14 08:24:44 -04:00
parent e770ee9794
commit 68bd4903fd
6 changed files with 54 additions and 31 deletions
+1 -1
View File
@@ -221,7 +221,7 @@ func ShowCommandHelp(ctx *Context, command string) error {
if ctx.App.CommandNotFound == nil {
errMsg := fmt.Sprintf("No help topic for '%v'", command)
if ctx.App.Suggest {
if suggestion := suggestCommand(ctx.App.Commands, command); suggestion != "" {
if suggestion := SuggestCommand(ctx.App.Commands, command); suggestion != "" {
errMsg += ". " + suggestion
}
}