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

Method PersistentFlags

command.go:1775–1784  ·  command.go::Command.PersistentFlags

PersistentFlags returns the persistent FlagSet specifically set in the current command.

()

Source from the content-addressed store, hash-verified

1773
1774// PersistentFlags returns the persistent FlagSet specifically set in the current command.
1775func (c *Command) PersistentFlags() *flag.FlagSet {
1776 if c.pflags == nil {
1777 c.pflags = flag.NewFlagSet(c.DisplayName(), flag.ContinueOnError)
1778 if c.flagErrorBuf == nil {
1779 c.flagErrorBuf = new(bytes.Buffer)
1780 }
1781 c.pflags.SetOutput(c.flagErrorBuf)
1782 }
1783 return c.pflags
1784}
1785
1786// ResetFlags deletes all flags from command.
1787func (c *Command) ResetFlags() {

Calls 2

DisplayNameMethod · 0.95
SetOutputMethod · 0.80