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

Method MarkPersistentFlagRequired

shell_completions.go:31–33  ·  view source on GitHub ↗

MarkPersistentFlagRequired instructs the various shell completion implementations to prioritize the named persistent 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

29// prioritize the named persistent flag when performing completion,
30// and causes your command to report an error if invoked without the flag.
31func (c *Command) MarkPersistentFlagRequired(name string) error {
32 return MarkFlagRequired(c.PersistentFlags(), name)
33}
34
35// MarkFlagRequired instructs the various shell completion implementations to
36// prioritize the named flag when performing completion,

Calls 2

PersistentFlagsMethod · 0.95
MarkFlagRequiredFunction · 0.85