Get the complete FlagSet that applies to this command (local and persistent declared here and by all parents)
()
| 860 | |
| 861 | // Get the complete FlagSet that applies to this command (local and persistent declared here and by all parents) |
| 862 | func (c *Command) Flags() *flag.FlagSet { |
| 863 | if c.flags == nil { |
| 864 | c.flags = flag.NewFlagSet(c.Name(), flag.ContinueOnError) |
| 865 | if c.flagErrorBuf == nil { |
| 866 | c.flagErrorBuf = new(bytes.Buffer) |
| 867 | } |
| 868 | c.flags.SetOutput(c.flagErrorBuf) |
| 869 | c.PersistentFlags().BoolVarP(&c.helpFlagVal, "help", "h", false, "help for "+c.Name()) |
| 870 | } |
| 871 | return c.flags |
| 872 | } |
| 873 | |
| 874 | // Get the local FlagSet specifically set in the current command |
| 875 | func (c *Command) LocalFlags() *flag.FlagSet { |