diff --git a/app.go b/app.go index 45c5ab2..dd7c9e4 100644 --- a/app.go +++ b/app.go @@ -11,7 +11,7 @@ import ( "time" ) -const didYouMeanTemplate = "Did you mean '%s'?" +const suggestDidYouMeanTemplate = "Did you mean %q?" var ( changeLogURL = "https://github.com/urfave/cli/blob/main/docs/CHANGELOG.md" @@ -21,8 +21,9 @@ var ( fmt.Sprintf("Must be `func(*Context`)` or `func(*Context) error). %s", contactSysadmin)+ fmt.Sprintf("See %s", appActionDeprecationURL), 2) - SuggestFlag SuggestFlagFunc = suggestFlag - SuggestCommand SuggestCommandFunc = suggestCommand + SuggestFlag SuggestFlagFunc = suggestFlag + SuggestCommand SuggestCommandFunc = suggestCommand + SuggestDidYouMeanTemplate string = suggestDidYouMeanTemplate ) // App is the main structure of a cli application. It is recommended that @@ -361,7 +362,7 @@ func (a *App) suggestFlagFromError(err error, command string) (string, error) { return "", err } - return fmt.Sprintf(didYouMeanTemplate+"\n\n", suggestion), nil + return fmt.Sprintf(SuggestDidYouMeanTemplate+"\n\n", suggestion), nil } // RunAndExitOnError calls .Run() and exits non-zero if an error was returned diff --git a/godoc-current.txt b/godoc-current.txt index e1879ee..acdac5e 100644 --- a/godoc-current.txt +++ b/godoc-current.txt @@ -27,8 +27,9 @@ application: VARIABLES var ( - SuggestFlag SuggestFlagFunc = suggestFlag - SuggestCommand SuggestCommandFunc = suggestCommand + SuggestFlag SuggestFlagFunc = suggestFlag + SuggestCommand SuggestCommandFunc = suggestCommand + SuggestDidYouMeanTemplate string = suggestDidYouMeanTemplate ) var AppHelpTemplate = `NAME: {{.Name}}{{if .Usage}} - {{.Usage}}{{end}} diff --git a/suggestions.go b/suggestions.go index 8df0b32..65bb3cf 100644 --- a/suggestions.go +++ b/suggestions.go @@ -47,5 +47,5 @@ func suggestCommand(commands []*Command, provided string) (suggestion string) { } } - return fmt.Sprintf(didYouMeanTemplate, suggestion) + return fmt.Sprintf(SuggestDidYouMeanTemplate, suggestion) } diff --git a/suggestions_test.go b/suggestions_test.go index c2a3d17..4c0984e 100644 --- a/suggestions_test.go +++ b/suggestions_test.go @@ -56,7 +56,7 @@ func TestSuggestFlagFromError(t *testing.T) { ) // Then - expect(t, res, fmt.Sprintf(didYouMeanTemplate+"\n\n", testCase.expected)) + expect(t, res, fmt.Sprintf(SuggestDidYouMeanTemplate+"\n\n", testCase.expected)) } } @@ -116,7 +116,7 @@ func TestSuggestCommand(t *testing.T) { res := suggestCommand(app.Commands, testCase.provided) // Then - expect(t, res, fmt.Sprintf(didYouMeanTemplate, testCase.expected)) + expect(t, res, fmt.Sprintf(SuggestDidYouMeanTemplate, testCase.expected)) } } @@ -140,7 +140,7 @@ func ExampleApp_Suggest() { // Output: // Incorrect Usage. flag provided but not defined: -nema // - // Did you mean '--name'? + // Did you mean "--name"? // // (this space intentionally left blank) } @@ -181,7 +181,7 @@ func ExampleApp_Suggest_command() { // Output: // Incorrect Usage: flag provided but not defined: -sliming // - // Did you mean '--smiling'? + // Did you mean "--smiling"? // // (this space intentionally left blank) } diff --git a/testdata/godoc-v2.x.txt b/testdata/godoc-v2.x.txt index e1879ee..acdac5e 100644 --- a/testdata/godoc-v2.x.txt +++ b/testdata/godoc-v2.x.txt @@ -27,8 +27,9 @@ application: VARIABLES var ( - SuggestFlag SuggestFlagFunc = suggestFlag - SuggestCommand SuggestCommandFunc = suggestCommand + SuggestFlag SuggestFlagFunc = suggestFlag + SuggestCommand SuggestCommandFunc = suggestCommand + SuggestDidYouMeanTemplate string = suggestDidYouMeanTemplate ) var AppHelpTemplate = `NAME: {{.Name}}{{if .Usage}} - {{.Usage}}{{end}}