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

Function writeCommands

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

Source from the content-addressed store, hash-verified

445}
446
447func writeCommands(buf io.StringWriter, cmd *Command) {
448 WriteStringAndCheck(buf, " commands=()\n")
449 for _, c := range cmd.Commands() {
450 if !c.IsAvailableCommand() && c != cmd.helpCommand {
451 continue
452 }
453 WriteStringAndCheck(buf, fmt.Sprintf(" commands+=(%q)\n", c.Name()))
454 writeCmdAliases(buf, c)
455 }
456 WriteStringAndCheck(buf, "\n")
457}
458
459func writeFlagHandler(buf io.StringWriter, name string, annotations map[string][]string, cmd *Command) {
460 for key, value := range annotations {

Callers 1

genFunction · 0.85

Calls 5

WriteStringAndCheckFunction · 0.85
writeCmdAliasesFunction · 0.85
CommandsMethod · 0.80
IsAvailableCommandMethod · 0.80
NameMethod · 0.80

Tested by

no test coverage detected