Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsSecretFlag ¶
IsSecretFlag returns true of s contains flag name with secret value, which shouldn't be exposed.
func RegisterSecretFlag ¶
func RegisterSecretFlag(flagName string)
RegisterSecretFlag registers flagName as secret.
This function must be called before starting logging. It cannot be called from concurrent goroutines.
Secret flags aren't exported at `/metrics` page.
Types ¶
type ArrayBool ¶
type ArrayBool []bool
ArrayBool is a flag that holds an array of booleans values.
Has the same api as ArrayString.
func NewArrayBool ¶
NewArrayBool returns new ArrayBool with the given name and description.
func (*ArrayBool) GetOptionalArg ¶
GetOptionalArg returns optional arg under the given argIdx.
func (*ArrayBool) IsBoolFlag ¶
IsBoolFlag implements flag.IsBoolFlag interface
type ArrayBytes ¶
type ArrayBytes []*Bytes
ArrayBytes is flag that holds an array of Bytes.
Has the same api as ArrayString.
func NewArrayBytes ¶
func NewArrayBytes(name, description string) *ArrayBytes
NewArrayBytes returns new ArrayBytes with the given name and description.
func (*ArrayBytes) GetOptionalArgOrDefault ¶
func (a *ArrayBytes) GetOptionalArgOrDefault(argIdx, defaultValue int) int
GetOptionalArgOrDefault returns optional arg under the given argIdx.
func (*ArrayBytes) Set ¶
func (a *ArrayBytes) Set(value string) error
Set implemented flag.Value interface
func (*ArrayBytes) String ¶
func (a *ArrayBytes) String() string
String implements flag.Value interface
type ArrayDuration ¶
ArrayDuration is a flag that holds an array of time.Duration values.
Has the same api as ArrayString.
func NewArrayDuration ¶
func NewArrayDuration(name, description string) *ArrayDuration
NewArrayDuration returns new ArrayDuration with the given name and description.
func (*ArrayDuration) GetOptionalArgOrDefault ¶
func (a *ArrayDuration) GetOptionalArgOrDefault(argIdx int, defaultValue time.Duration) time.Duration
GetOptionalArgOrDefault returns optional arg under the given argIdx, or default value, if argIdx not found.
func (*ArrayDuration) Set ¶
func (a *ArrayDuration) Set(value string) error
Set implements flag.Value interface
func (*ArrayDuration) String ¶
func (a *ArrayDuration) String() string
String implements flag.Value interface
type ArrayInt ¶
type ArrayInt []int
ArrayInt is flag that holds an array of ints.
Has the same api as ArrayString.
func NewArrayInt ¶
NewArrayInt returns new ArrayInt with the given name and description.
func (*ArrayInt) GetOptionalArgOrDefault ¶
GetOptionalArgOrDefault returns optional arg under the given argIdx.
type ArrayString ¶
type ArrayString []string
ArrayString is a flag that holds an array of strings.
It may be set either by specifying multiple flags with the given name passed to NewArray or by joining flag values by comma.
The following example sets equivalent flag array with two items (value1, value2):
-foo=value1 -foo=value2 -foo=value1,value2
Flag values may be quoted. For instance, the following arg creates an array of ("a", "b, c") items:
-foo='a,"b, c"'
func NewArrayString ¶
func NewArrayString(name, description string) *ArrayString
NewArrayString returns new ArrayString with the given name and description.
func (*ArrayString) GetOptionalArg ¶
func (a *ArrayString) GetOptionalArg(argIdx int) string
GetOptionalArg returns optional arg under the given argIdx.
func (*ArrayString) Set ¶
func (a *ArrayString) Set(value string) error
Set implements flag.Value interface
func (*ArrayString) String ¶
func (a *ArrayString) String() string
String implements flag.Value interface
type Bytes ¶
type Bytes struct { // N contains parsed value for the given flag. N int // contains filtered or unexported fields }
Bytes is a flag for holding size in bytes.
It supports the following optional suffixes for values: KB, MB, GB, KiB, MiB, GiB.
type Duration ¶
type Duration struct { // Msecs contains parsed duration in milliseconds. Msecs int64 // contains filtered or unexported fields }
Duration is a flag for holding duration.
func NewDuration ¶
NewDuration returns new `duration` flag with the given name, defaultValue and description.
DefaultValue is in months.