mirror of
https://github.com/spf13/cobra
synced 2025-05-05 21:07:24 +00:00
Merge 658b0c71fb
into 8d4ce3549a
This commit is contained in:
commit
4e0949d3c3
1 changed files with 5 additions and 5 deletions
10
command.go
10
command.go
|
@ -521,13 +521,13 @@ func (c *Command) Find(args []string) (*Command, []string, error) {
|
|||
}
|
||||
|
||||
// root command with subcommands, do subcommand checking
|
||||
if commandFound == c && len(argsWOflags) > 0 {
|
||||
if commandFound != nil && len(argsWOflags) > 0 {
|
||||
suggestionsString := ""
|
||||
if !c.DisableSuggestions {
|
||||
if c.SuggestionsMinimumDistance <= 0 {
|
||||
c.SuggestionsMinimumDistance = 2
|
||||
if !commandFound.DisableSuggestions {
|
||||
if commandFound.SuggestionsMinimumDistance <= 0 {
|
||||
commandFound.SuggestionsMinimumDistance = 2
|
||||
}
|
||||
if suggestions := c.SuggestionsFor(argsWOflags[0]); len(suggestions) > 0 {
|
||||
if suggestions := commandFound.SuggestionsFor(argsWOflags[0]); len(suggestions) > 0 {
|
||||
suggestionsString += "\n\nDid you mean this?\n"
|
||||
for _, s := range suggestions {
|
||||
suggestionsString += fmt.Sprintf("\t%v\n", s)
|
||||
|
|
Loading…
Add table
Reference in a new issue