Documentation ¶
Overview ¶
Package flag provides a very minimal command line flag parser. Both short flags (-s) and long flags (--long) are supported. Short flags can be chained (-xvzf) and "--" is treated as the end of flags marker. Boolean and integer values have first-class support; strings values are intended to serve as a catch-all for anything else.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Bool ¶
Bool defines a bool flag with the specified short and/or long variants, base value, and usage text. The argument val points to where the value is stored.
func Int64 ¶ added in v0.2.0
Int64 defines an int64 flag with the specified short and/or long variants, base value, and usage text. The argument val points to where the value is stored.
func Parse ¶
Parse parses the command line flags from os.Args[firstFlag:] and returns the index of the first non-flag command line argument. If present, "--" is treated as the end of flags marker and the index of the next argument is returned. If Parse encounters a flag that has not been defined PrintUsageAndExit will be called.
func PrintUsageAndExit ¶
func PrintUsageAndExit()
PrintUsageAndExit prints usage text based on the defined flags and exits.
Types ¶
This section is empty.