MCPcopy
hub / github.com/spf13/cobra / findSuggestions

Method findSuggestions

command.go:781–796  ·  view source on GitHub ↗
(arg string)

Source from the content-addressed store, hash-verified

779}
780
781func (c *Command) findSuggestions(arg string) string {
782 if c.DisableSuggestions {
783 return ""
784 }
785 if c.SuggestionsMinimumDistance <= 0 {
786 c.SuggestionsMinimumDistance = 2
787 }
788 var sb strings.Builder
789 if suggestions := c.SuggestionsFor(arg); len(suggestions) > 0 {
790 sb.WriteString("\n\nDid you mean this?\n")
791 for _, s := range suggestions {
792 _, _ = fmt.Fprintf(&sb, "\t%v\n", s)
793 }
794 }
795 return sb.String()
796}
797
798func (c *Command) findNext(next string) *Command {
799 matches := make([]*Command, 0)

Callers 2

legacyArgsFunction · 0.80
OnlyValidArgsFunction · 0.80

Calls 2

SuggestionsForMethod · 0.95
StringMethod · 0.80

Tested by

no test coverage detected