Flags returns the complete FlagSet that applies to this command (local and persistent declared here and by all parents).
()
| 1686 | // Flags returns the complete FlagSet that applies |
| 1687 | // to this command (local and persistent declared here and by all parents). |
| 1688 | func (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. |