Documentation ¶
Index ¶
- func Alias(short, long, description string)
- func CheckBool(flag string) bool
- func CheckInt(flag string) bool
- func CheckString(flag string) bool
- func FlagPresent(flag string) bool
- func GetBool(flag string) bool
- func GetInt(flag string) int
- func GetString(flag string) string
- func ParseCommandLine()
- func SetIntDefault(flag string, value int)
- func SetStringDefault(flag, value string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Alias ¶
func Alias(short, long, description string)
Alias associates one long flag to a short flag. Also, a description for that flag pair can be specified which will be included in --help/-h output. All aliases must be declared before any call to FlagPresent(), GetBool(), GetInt() or GetString().
func FlagPresent ¶ added in v1.2.0
FlagPresent checks if flag was specified on the command line.
func GetBool ¶
GetBool checks if flag is present on the command line. It prints an error and exits the program if flag is not used in a boolean context (i.e. is followed by a value).
func GetInt ¶
GetInt fetches the value of an int flag. It prints an error and exits the program if flag is missing or no int value is specified.
func GetString ¶
GetString fetches the value of a string flag. It prints an error and exits the program if flag is missing or no string value is specified.
func SetIntDefault ¶ added in v1.2.0
SetIntDefault sets a default value for an int type flag. Defaults must be declared before any call to FlagPresent(), GetBool(), GetInt() or GetString().
func SetStringDefault ¶ added in v1.2.0
func SetStringDefault(flag, value string)
SetStringDefault sets a default value for a string type flag. Defaults must be declared before any call to FlagPresent(), GetBool(), GetInt() or GetString().
Types ¶
This section is empty.