Documentation ¶
Overview ¶
Package cliflag extends flagset with environment variable defaults.
Usage:
cliflag.String(root.Flags(), &address, "address", "a", "CODER_ADDRESS", "127.0.0.1:3000", "The address to serve the API and dashboard")
Will produce the following usage docs:
-a, --address string The address to serve the API and dashboard (uses $CODER_ADDRESS). (default "127.0.0.1:3000")
Index ¶
- func Bool(flagset *pflag.FlagSet, name, shorthand, env string, def bool, usage string)
- func BoolVarP(flagset *pflag.FlagSet, ptr *bool, name string, shorthand string, env string, ...)
- func DurationVarP(flagset *pflag.FlagSet, ptr *time.Duration, name string, shorthand string, ...)
- func IntVarP(flagset *pflag.FlagSet, ptr *int, name string, shorthand string, env string, ...)
- func IsSet(cmd *cobra.Command, name string) (string, bool)
- func IsSetBool(cmd *cobra.Command, name string) bool
- func String(flagset *pflag.FlagSet, name, shorthand, env, def, usage string)
- func StringArray(flagset *pflag.FlagSet, name, shorthand, env string, def []string, ...)
- func StringArrayVarP(flagset *pflag.FlagSet, ptr *[]string, name string, shorthand string, ...)
- func StringVarP(flagset *pflag.FlagSet, p *string, name string, shorthand string, env string, ...)
- func Uint8VarP(flagset *pflag.FlagSet, ptr *uint8, name string, shorthand string, env string, ...)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BoolVarP ¶
func BoolVarP(flagset *pflag.FlagSet, ptr *bool, name string, shorthand string, env string, def bool, usage string)
BoolVarP sets a bool flag on the given flag set.
func DurationVarP ¶ added in v0.6.0
func DurationVarP(flagset *pflag.FlagSet, ptr *time.Duration, name string, shorthand string, env string, def time.Duration, usage string)
DurationVarP sets a time.Duration flag on the given flag set.
func IntVarP ¶ added in v0.8.11
func IntVarP(flagset *pflag.FlagSet, ptr *int, name string, shorthand string, env string, def int, usage string)
IntVarP sets a uint8 flag on the given flag set.
func IsSetBool ¶ added in v0.8.0
IsSetBool returns the value of the boolean flag if it is set. It returns false if the flag isn't set or if any error occurs attempting to parse the value of the flag.
func StringArray ¶ added in v0.8.15
func StringArrayVarP ¶ added in v0.4.4
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.