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

Function writeShortFlag

bash_completions.go:497–506  ·  view source on GitHub ↗
(buf io.StringWriter, flag *pflag.Flag, cmd *Command)

Source from the content-addressed store, hash-verified

495const cbn = "\")\n"
496
497func writeShortFlag(buf io.StringWriter, flag *pflag.Flag, cmd *Command) {
498 name := flag.Shorthand
499 format := " "
500 if len(flag.NoOptDefVal) == 0 {
501 format += "two_word_"
502 }
503 format += "flags+=(\"-%s" + cbn
504 WriteStringAndCheck(buf, fmt.Sprintf(format, name))
505 writeFlagHandler(buf, "-"+name, flag.Annotations, cmd)
506}
507
508func writeFlag(buf io.StringWriter, flag *pflag.Flag, cmd *Command) {
509 name := flag.Name

Callers 1

writeFlagsFunction · 0.85

Calls 2

WriteStringAndCheckFunction · 0.85
writeFlagHandlerFunction · 0.85

Tested by

no test coverage detected