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

Function writeRequiredNouns

bash_completions.go:615–627  ·  view source on GitHub ↗
(buf io.StringWriter, cmd *Command)

Source from the content-addressed store, hash-verified

613}
614
615func writeRequiredNouns(buf io.StringWriter, cmd *Command) {
616 WriteStringAndCheck(buf, " must_have_one_noun=()\n")
617 sort.Strings(cmd.ValidArgs)
618 for _, value := range cmd.ValidArgs {
619 // Remove any description that may be included following a tab character.
620 // Descriptions are not supported by bash completion.
621 value = strings.SplitN(value, "\t", 2)[0]
622 WriteStringAndCheck(buf, fmt.Sprintf(" must_have_one_noun+=(%q)\n", value))
623 }
624 if cmd.ValidArgsFunction != nil {
625 WriteStringAndCheck(buf, " has_completion_function=1\n")
626 }
627}
628
629func writeCmdAliases(buf io.StringWriter, cmd *Command) {
630 if len(cmd.Aliases) == 0 {

Callers 1

genFunction · 0.85

Calls 1

WriteStringAndCheckFunction · 0.85

Tested by

no test coverage detected