Documentation ¶
Overview ¶
Package flag provides types and functions to create and manage your command line applications
Package flag provides types and functions to create and manage your command line applications
Index ¶
- type Flag
- type Flags
- func (f *Flags) AppendHelpIfNotPresent()
- func (f *Flags) AppendVersionIfNotPreset()
- func (f Flags) Bool(arg string) bool
- func (f Flags) Flag(name string) *Flag
- func (f Flags) Float(arg string) float64
- func (f Flags) Int(arg string) int
- func (f Flags) Parse(args []string) ([]string, error)
- func (f Flags) RequiredAreParsed() error
- func (f Flags) String(arg string) string
- func (f Flags) Validate() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Flag ¶
type Flag struct { // Short is the short name of the flag Short string // Long is the long name of the flag Long string // Description holds information describing the // behavior of the flag can have Description string // Type is the value type of the flag Type argument.Type // Required is true when the user is required to // pass this flag in the command line Required bool // contains filtered or unexported fields }
Flag type holds all information for a flag to be parsed on the command line
type Flags ¶
type Flags []Flag
Flags type is a list of command line flags
func (*Flags) AppendHelpIfNotPresent ¶
func (f *Flags) AppendHelpIfNotPresent()
AppendHelpIfNotPresent if the help flag is not present in the underlying slice append the default one
func (*Flags) AppendVersionIfNotPreset ¶
func (f *Flags) AppendVersionIfNotPreset()
AppendVersionIfNotPreset if the version flag is not present in the underlying slice append the default one
func (Flags) Parse ¶
Parse parses the command line arguments and returns the one that has are not flags
func (Flags) RequiredAreParsed ¶
RequiredAreParsed checks if all the required flags has been parsed