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

Method MarkFlagCustom

shell_completions.go:54–56  ·  view source on GitHub ↗

MarkFlagCustom adds the BashCompCustom annotation to the named flag, if it exists. The bash completion script will call the bash function f for the flag. This will only work for bash completion. It is recommended to instead use c.RegisterFlagCompletionFunc(...) which allows to register a Go functio

(name string, f string)

Source from the content-addressed store, hash-verified

52// It is recommended to instead use c.RegisterFlagCompletionFunc(...) which allows
53// to register a Go function which will work across all shells.
54func (c *Command) MarkFlagCustom(name string, f string) error {
55 return MarkFlagCustom(c.Flags(), name, f)
56}
57
58// MarkPersistentFlagFilename instructs the various shell completion
59// implementations to limit completions for the named persistent flag to the

Callers 1

TestBashCompletionsFunction · 0.95

Calls 2

FlagsMethod · 0.95
MarkFlagCustomFunction · 0.85

Tested by 1

TestBashCompletionsFunction · 0.76