Documentation ¶
Index ¶
- type FlagSet
- func (f *FlagSet) Alias(short, long string)
- func (f *FlagSet) Bool(group string, name string, value bool, usage string) *bool
- func (f *FlagSet) BoolVar(group string, p *bool, name string, value bool, usage string)
- func (f *FlagSet) DurationVar(group string, p *time.Duration, name string, value time.Duration, usage string)
- func (f *FlagSet) Float64Var(group string, p *float64, name string, value float64, usage string)
- func (f *FlagSet) Init(name string, errorHandling flag.ErrorHandling)
- func (f *FlagSet) InitGroup(name, description string)
- func (f *FlagSet) Int64Var(group string, p *int64, name string, value int64, usage string)
- func (f *FlagSet) IntVar(group string, p *int, name string, value int, usage string)
- func (f *FlagSet) Lookup(name string) *flag.Flag
- func (f *FlagSet) Parse(args []string) error
- func (f *FlagSet) PrintDefaults()
- func (f *FlagSet) SetExamples(examples string)
- func (f *FlagSet) SetOutput(output io.Writer)
- func (f *FlagSet) SetUsage(usage string)
- func (f *FlagSet) StringVar(group string, p *string, name string, value string, usage string)
- func (f *FlagSet) Uint64Var(group string, p *uint64, name string, value uint64, usage string)
- func (f *FlagSet) UintVar(group string, p *uint, name string, value uint, usage string)
- func (f *FlagSet) Var(group string, value flag.Value, name string, usage string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FlagSet ¶
func NewFlagSet ¶
func NewFlagSet(name string, errorHandling flag.ErrorHandling) *FlagSet
NewFlagSet creates a new FlagSet with the specified name and error handling behavior.
func (*FlagSet) Alias ¶
Alias creates an alias between two flag names. Either the short or the long name must be already defined. If both flags are defined or neither is defined, it panics.
func (*FlagSet) Bool ¶
Bool defines a bool flag with specified name, default value, and usage string, and returns the address of a bool variable that stores the value of the flag.
func (*FlagSet) BoolVar ¶
BoolVar defines a bool flag with specified name, default value, and usage string. The argument p points to a bool variable in which to store the value of the flag.
func (*FlagSet) DurationVar ¶
func (f *FlagSet) DurationVar(group string, p *time.Duration, name string, value time.Duration, usage string)
DurationVar defines a time.Duration flag with specified name, default value, and usage string. The argument p points to a time.Duration variable in which to store the value of the flag.
func (*FlagSet) Float64Var ¶
Float64Var defines a float64 flag with specified name, default value, and usage string. The argument p points to a float64 variable in which to store the value of the flag.
func (*FlagSet) Init ¶
func (f *FlagSet) Init(name string, errorHandling flag.ErrorHandling)
Init initializes a FlagSet with the provided name and error handling behavior. This method is called by NewFlagSet and can also be called to reset an existing FlagSet.
func (*FlagSet) InitGroup ¶
InitGroup initializes a new group of flags with the given name and description. Flags can be added to this group using the various flag definition methods.
func (*FlagSet) Int64Var ¶
Int64Var defines an int64 flag with specified name, default value, and usage string. The argument p points to an int64 variable in which to store the value of the flag.
func (*FlagSet) IntVar ¶
IntVar defines an int flag with specified name, default value, and usage string. The argument p points to an int variable in which to store the value of the flag.
func (*FlagSet) Lookup ¶
Lookup returns the Flag structure of the named command-line flag. Returns nil if the flag does not exist.
func (*FlagSet) Parse ¶
Parse parses command-line arguments from args. Must be called after all flags are defined and before flags are accessed by the program.
func (*FlagSet) PrintDefaults ¶
func (f *FlagSet) PrintDefaults()
PrintDefaults prints, to the output defined with SetOutput, the default values of all defined command-line flags in the FlagSet.
func (*FlagSet) SetExamples ¶
SetExamples sets a custom examples section for the FlagSet, to be displayed in usage output.
func (*FlagSet) SetOutput ¶
SetOutput sets the destination for usage and error messages. If output is nil, os.Stderr is used.
func (*FlagSet) StringVar ¶
StringVar defines a string flag with specified name, default value, and usage string. The argument p points to a string variable in which to store the value of the flag.
func (*FlagSet) Uint64Var ¶
Uint64Var defines a uint64 flag with specified name, default value, and usage string. The argument p points to a uint64 variable in which to store the value of the flag.