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

Method MarkFlagRequired

shell_completions.go:24–26  ·  view source on GitHub ↗

MarkFlagRequired instructs the various shell completion implementations to prioritize the named flag when performing completion, and causes your command to report an error if invoked without the flag.

(name string)

Source from the content-addressed store, hash-verified

22// prioritize the named flag when performing completion,
23// and causes your command to report an error if invoked without the flag.
24func (c *Command) MarkFlagRequired(name string) error {
25 return MarkFlagRequired(c.Flags(), name)
26}
27
28// MarkPersistentFlagRequired instructs the various shell completion implementations to
29// prioritize the named persistent flag when performing completion,

Callers 6

TestCompletionCobraFlagsFunction · 0.95
TestBashCompletionsFunction · 0.95
TestRequiredFlagsFunction · 0.95

Calls 2

FlagsMethod · 0.95
MarkFlagRequiredFunction · 0.85

Tested by 5

TestCompletionCobraFlagsFunction · 0.76
TestBashCompletionsFunction · 0.76
TestRequiredFlagsFunction · 0.76