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

Method Flags

command.go:1688–1698  ·  command.go::Command.Flags

Flags returns the complete FlagSet that applies to this command (local and persistent declared here and by all parents).

()

Source from the content-addressed store, hash-verified

1686// Flags returns the complete FlagSet that applies
1687// to this command (local and persistent declared here and by all parents).
1688func (c *Command) Flags() *flag.FlagSet {
1689 if c.flags == nil {
1690 c.flags = flag.NewFlagSet(c.DisplayName(), flag.ContinueOnError)
1691 if c.flagErrorBuf == nil {
1692 c.flagErrorBuf = new(bytes.Buffer)
1693 }
1694 c.flags.SetOutput(c.flagErrorBuf)
1695 }
1696
1697 return c.flags
1698}
1699
1700// LocalNonPersistentFlags are flags specific to this command which will NOT persist to subcommands.
1701// This function does not modify the flags of the current command, it's purpose is to return the current state.

Callers 15

TestValidateFlagGroupsFunction · 0.95
MarkFlagsOneRequiredMethod · 0.95
ValidateFlagGroupsMethod · 0.95
TestActiveHelpForFlagFunction · 0.95
TestConfigActiveHelpFunction · 0.95
getCompletionsMethod · 0.95

Calls 2

DisplayNameMethod · 0.95
SetOutputMethod · 0.80