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

Method ResetFlags

command.go:1787–1798  ·  view source on GitHub ↗

ResetFlags deletes all flags from command.

()

Source from the content-addressed store, hash-verified

1785
1786// ResetFlags deletes all flags from command.
1787func (c *Command) ResetFlags() {
1788 c.flagErrorBuf = new(bytes.Buffer)
1789 c.flagErrorBuf.Reset()
1790 c.flags = flag.NewFlagSet(c.DisplayName(), flag.ContinueOnError)
1791 c.flags.SetOutput(c.flagErrorBuf)
1792 c.pflags = flag.NewFlagSet(c.DisplayName(), flag.ContinueOnError)
1793 c.pflags.SetOutput(c.flagErrorBuf)
1794
1795 c.lflags = nil
1796 c.iflags = nil
1797 c.parentsPflags = nil
1798}
1799
1800// HasFlags checks if the command contains any flags (local plus persistent from the entire structure).
1801func (c *Command) HasFlags() bool {

Callers

nothing calls this directly

Calls 2

DisplayNameMethod · 0.95
SetOutputMethod · 0.80

Tested by

no test coverage detected