Documentation ¶
Index ¶
- func GetBool(fs *FlagSet, name string) bool
- func GetBoolPtr(fs *FlagSet, name string) *bool
- func GetBoolSlice(fs *FlagSet, name string) []bool
- func GetBoolSlicePtr(fs *FlagSet, name string) *[]bool
- func GetCounter(fs *FlagSet, name string) int
- func GetDuration(fs *FlagSet, name string) time.Duration
- func GetDurationPtr(fs *FlagSet, name string) *time.Duration
- func GetDurationSlice(fs *FlagSet, name string) []time.Duration
- func GetDurationSlicePtr(fs *FlagSet, name string) *[]time.Duration
- func GetFloat32(fs *FlagSet, name string) float32
- func GetFloat32Ptr(fs *FlagSet, name string) *float32
- func GetFloat32Slice(fs *FlagSet, name string) []float32
- func GetFloat32SlicePtr(fs *FlagSet, name string) *[]float32
- func GetFloat64(fs *FlagSet, name string) float64
- func GetFloat64Ptr(fs *FlagSet, name string) *float64
- func GetFloat64Slice(fs *FlagSet, name string) []float64
- func GetFloat64SlicePtr(fs *FlagSet, name string) *[]float64
- func GetInt(fs *FlagSet, name string) int
- func GetInt16(fs *FlagSet, name string) int16
- func GetInt16Ptr(fs *FlagSet, name string) *int16
- func GetInt16Slice(fs *FlagSet, name string) []int16
- func GetInt16SlicePtr(fs *FlagSet, name string) *[]int16
- func GetInt32(fs *FlagSet, name string) int32
- func GetInt32Ptr(fs *FlagSet, name string) *int32
- func GetInt32Slice(fs *FlagSet, name string) []int32
- func GetInt32SlicePtr(fs *FlagSet, name string) *[]int32
- func GetInt64(fs *FlagSet, name string) int64
- func GetInt64Ptr(fs *FlagSet, name string) *int64
- func GetInt64Slice(fs *FlagSet, name string) []int64
- func GetInt64SlicePtr(fs *FlagSet, name string) *[]int64
- func GetInt8(fs *FlagSet, name string) int8
- func GetInt8Ptr(fs *FlagSet, name string) *int8
- func GetInt8Slice(fs *FlagSet, name string) []int8
- func GetInt8SlicePtr(fs *FlagSet, name string) *[]int8
- func GetIntPtr(fs *FlagSet, name string) *int
- func GetIntSlice(fs *FlagSet, name string) []int
- func GetIntSlicePtr(fs *FlagSet, name string) *[]int
- func GetString(fs *FlagSet, name string) string
- func GetStringPtr(fs *FlagSet, name string) *string
- func GetStringSlice(fs *FlagSet, name string) []string
- func GetStringSlicePtr(fs *FlagSet, name string) *[]string
- func GetTypedFlag[T any](fs *FlagSet, name string) T
- func GetTypedFlagPtr[T any](fs *FlagSet, name string) *T
- func GetUint(fs *FlagSet, name string) uint
- func GetUint16(fs *FlagSet, name string) uint16
- func GetUint16Ptr(fs *FlagSet, name string) *uint16
- func GetUint16Slice(fs *FlagSet, name string) []uint16
- func GetUint16SlicePtr(fs *FlagSet, name string) *[]uint16
- func GetUint32(fs *FlagSet, name string) uint32
- func GetUint32Ptr(fs *FlagSet, name string) *uint32
- func GetUint32Slice(fs *FlagSet, name string) []uint32
- func GetUint32SlicePtr(fs *FlagSet, name string) *[]uint32
- func GetUint64(fs *FlagSet, name string) uint64
- func GetUint64Ptr(fs *FlagSet, name string) *uint64
- func GetUint64Slice(fs *FlagSet, name string) []uint64
- func GetUint64SlicePtr(fs *FlagSet, name string) *[]uint64
- func GetUint8(fs *FlagSet, name string) uint8
- func GetUint8Ptr(fs *FlagSet, name string) *uint8
- func GetUint8Slice(fs *FlagSet, name string) []uint8
- func GetUint8SlicePtr(fs *FlagSet, name string) *[]uint8
- func GetUintPtr(fs *FlagSet, name string) *uint
- func GetUintSlice(fs *FlagSet, name string) []uint
- func GetUintSlicePtr(fs *FlagSet, name string) *[]uint
- type Builder
- type FlagSet
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetBool ¶
GetBool returns the bool value associated with the given name from the FlagSet. It will exit with code 1 if:
- flag does not exist
- flag value is nil
- flag value has a different type
func GetBoolPtr ¶
GetBoolPtr returns a pointer to a bool value associated with the given name from the FlagSet. If the flag value is not set, it returns nil. It will exit with code 1 if:
- flag does not exist
- flag value has a different type
func GetBoolSlice ¶
GetBoolSlice returns the []bool value associated with the given name from the FlagSet. It will exit with code 1 if:
- flag does not exist
- flag value is nil
- flag value has a different type
func GetBoolSlicePtr ¶
GetBoolSlicePtr returns a pointer to a []bool value associated with the given name from the FlagSet. If the flag value is not set, it returns nil. It will exit with code 1 if:
- flag does not exist
- flag value has a different type
func GetCounter ¶
GetCounter returns the uint64 value, reflecting the counter, associated with the given name from the FlagSet. It will exit with code 1 if:
- flag does not exist
- flag value is nil
- flag value has a different type
func GetDuration ¶
GetDuration returns the time.Duration value associated with the given name from the FlagSet. It will exit with code 1 if:
- flag does not exist
- flag value is nil
- flag value has a different type
func GetDurationPtr ¶
GetDurationPtr returns a pointer to a time.Duration value associated with the given name from the FlagSet. If the flag value is not set, it returns nil. It will exit with code 1 if:
- flag does not exist
- flag value has a different type
func GetDurationSlice ¶
GetDurationSlice returns the []time.Duration value associated with the given name from the FlagSet. It will exit with code 1 if:
- flag does not exist
- flag value is nil
- flag value has a different type
func GetDurationSlicePtr ¶
GetDurationSlicePtr returns a pointer to a []time.Duration value associated with the given name from the FlagSet. If the flag value is not set, it returns nil. It will exit with code 1 if:
- flag does not exist
- flag value has a different type
func GetFloat32 ¶
GetFloat32 returns the float32 value associated with the given name from the FlagSet. It will exit with code 1 if:
- flag does not exist
- flag value is nil
- flag value has a different type
func GetFloat32Ptr ¶
GetFloat32Ptr returns a pointer to a float32 value associated with the given name from the FlagSet. If the flag value is not set, it returns nil. It will exit with code 1 if:
- flag does not exist
- flag value has a different type
func GetFloat32Slice ¶
GetFloat32Slice returns the []float32 value associated with the given name from the FlagSet. It will exit with code 1 if:
- flag does not exist
- flag value is nil
- flag value has a different type
func GetFloat32SlicePtr ¶
GetFloat32SlicePtr returns a pointer to a float64 value associated with the given name from the FlagSet. If the flag value is not set, it returns nil. It will exit with code 1 if:
- flag does not exist
- flag value has a different type
func GetFloat64 ¶
GetFloat64 returns the float64 value associated with the given name from the FlagSet. It will exit with code 1 if:
- flag does not exist
- flag value is nil
- flag value has a different type
func GetFloat64Ptr ¶
GetFloat64Ptr returns a pointer to a float64 value associated with the given name from the FlagSet. If the flag value is not set, it returns nil. It will exit with code 1 if:
- flag does not exist
- flag value has a different type
func GetFloat64Slice ¶
GetFloat64Slice returns the []float64 value associated with the given name from the FlagSet. It will exit with code 1 if:
- flag does not exist
- flag value is nil
- flag value has a different type
func GetFloat64SlicePtr ¶
GetFloat64SlicePtr returns a pointer to a []float64 value associated with the given name from the FlagSet. If the flag value is not set, it returns nil. It will exit with code 1 if:
- flag does not exist
- flag value has a different type
func GetInt ¶
GetInt returns the int value associated with the given name from the FlagSet. It will exit with code 1 if:
- flag does not exist
- flag value is nil
- flag value has a different type
func GetInt16 ¶
GetInt16 returns the int16 value associated with the given name from the FlagSet. It will exit with code 1 if:
- flag does not exist
- flag value is nil
- flag value has a different type
func GetInt16Ptr ¶
GetInt16Ptr returns a pointer to an int16 value associated with the given name from the FlagSet. If the flag value is not set, it returns nil. It will exit with code 1 if:
- flag does not exist
- flag value has a different type
func GetInt16Slice ¶
GetInt16Slice returns the []int16 value associated with the given name from the FlagSet. It will exit with code 1 if:
- flag does not exist
- flag value is nil
- flag value has a different type
func GetInt16SlicePtr ¶
GetInt16SlicePtr returns a pointer to a []int16 value associated with the given name from the FlagSet. If the flag value is not set, it returns nil. It will exit with code 1 if:
- flag does not exist
- flag value has a different type
func GetInt32 ¶
GetInt32 returns the int32 value associated with the given name from the FlagSet. It will exit with code 1 if:
- flag does not exist
- flag value is nil
- flag value has a different type
func GetInt32Ptr ¶
GetInt32Ptr returns a pointer to an int32 value associated with the given name from the FlagSet. If the flag value is not set, it returns nil. It will exit with code 1 if:
- flag does not exist
- flag value has a different type
func GetInt32Slice ¶
GetInt32Slice returns the []int32 value associated with the given name from the FlagSet. It will exit with code 1 if:
- flag does not exist
- flag value is nil
- flag value has a different type
func GetInt32SlicePtr ¶
GetInt32SlicePtr returns a pointer to a []int32 value associated with the given name from the FlagSet. If the flag value is not set, it returns nil. It will exit with code 1 if:
- flag does not exist
- flag value has a different type
func GetInt64 ¶
GetInt64 returns the int64 value associated with the given name from the FlagSet. It will exit with code 1 if:
- flag does not exist
- flag value is nil
- flag value has a different type
func GetInt64Ptr ¶
GetInt64Ptr returns a pointer to an int64 value associated with the given name from the FlagSet. If the flag value is not set, it returns nil. It will exit with code 1 if:
- flag does not exist
- flag value has a different type
func GetInt64Slice ¶
GetInt64Slice returns the []int64 value associated with the given name from the FlagSet. It will exit with code 1 if:
- flag does not exist
- flag value is nil
- flag value has a different type
func GetInt64SlicePtr ¶
GetInt64SlicePtr returns a pointer to a []int64 value associated with the given name from the FlagSet. If the flag value is not set, it returns nil. It will exit with code 1 if:
- flag does not exist
- flag value has a different type
func GetInt8 ¶
GetInt8 returns the int8 value associated with the given name from the FlagSet. It will exit with code 1 if:
- flag does not exist
- flag value is nil
- flag value has a different type
func GetInt8Ptr ¶
GetInt8Ptr returns a pointer to an int8 value associated with the given name from the FlagSet. If the flag value is not set, it returns nil. It will exit with code 1 if:
- flag does not exist
- flag value has a different type
func GetInt8Slice ¶
GetInt8Slice returns the []int8 value associated with the given name from the FlagSet. It will exit with code 1 if:
- flag does not exist
- flag value is nil
- flag value has a different type
func GetInt8SlicePtr ¶
GetInt8SlicePtr returns a pointer to a []int8 value associated with the given name from the FlagSet. If the flag value is not set, it returns nil. It will exit with code 1 if:
- flag does not exist
- flag value has a different type
func GetIntPtr ¶
GetIntPtr returns a pointer to an int value associated with the given name from the FlagSet. If the flag value is not set, it returns nil. It will exit with code 1 if:
- flag does not exist
- flag value has a different type
func GetIntSlice ¶
GetIntSlice returns the []int value associated with the given name from the FlagSet. It will exit with code 1 if:
- flag does not exist
- flag value is nil
- flag value has a different type
func GetIntSlicePtr ¶
GetIntSlicePtr returns a pointer to a []int value associated with the given name from the FlagSet. If the flag value is not set, it returns nil. It will exit with code 1 if:
- flag does not exist
- flag value has a different type
func GetString ¶
GetString returns the string value associated with the given name from the FlagSet. It will exit with code 1 if:
- flag does not exist
- flag value is nil
- flag value has a different type
func GetStringPtr ¶
GetStringPtr returns a pointer to a string value associated with the given name from the FlagSet. If the flag value is not set, it returns nil. It will exit with code 1 if:
- flag does not exist
- flag value has a different type
func GetStringSlice ¶
GetStringSlice returns the []string value associated with the given name from the FlagSet. It will exit with code 1 if:
- flag does not exist
- flag value is nil
- flag value has a different type
func GetStringSlicePtr ¶
GetStringSlicePtr returns a pointer to a []string value associated with the given name from the FlagSet. If the flag value is not set, it returns nil. It will exit with code 1 if:
- flag does not exist
- flag value has a different type
func GetTypedFlag ¶
GetTypedFlag returns the value of defined type, associated with the given name from the given FlagSet. It will exit with code 1 if:
- flag does not exist
- flag value is nil
- flag value has a different type
func GetTypedFlagPtr ¶
GetTypedFlagPtr returns a pointer to the value of defined type, associated with the given name from the given FlagSet. If the flag value is not set, it returns nil. It will exit with code 1 if:
- flag does not exist
- flag value has a different type
func GetUint ¶
GetUint returns the uint value associated with the given name from the FlagSet. It will exit with code 1 if:
- flag does not exist
- flag value is nil
- flag value has a different type
func GetUint16 ¶
GetUint16 returns the uint16 value associated with the given name from the FlagSet. It will exit with code 1 if:
- flag does not exist
- flag value is nil
- flag value has a different type
func GetUint16Ptr ¶
GetUint16Ptr returns a pointer to an uint16 value associated with the given name from the FlagSet. If the flag value is not set, it returns nil. It will exit with code 1 if:
- flag does not exist
- flag value has a different type
func GetUint16Slice ¶
GetUint16Slice returns the []uint16 value associated with the given name from the FlagSet. It will exit with code 1 if:
- flag does not exist
- flag value is nil
- flag value has a different type
func GetUint16SlicePtr ¶
GetUint16SlicePtr returns a pointer to a []uint16 value associated with the given name from the FlagSet. If the flag value is not set, it returns nil. It will exit with code 1 if:
- flag does not exist
- flag value has a different type
func GetUint32 ¶
GetUint32 returns the uint32 value associated with the given name from the FlagSet. It will exit with code 1 if:
- flag does not exist
- flag value is nil
- flag value has a different type
func GetUint32Ptr ¶
GetUint32Ptr returns a pointer to an uint32 value associated with the given name from the FlagSet. If the flag value is not set, it returns nil. It will exit with code 1 if:
- flag does not exist
- flag value has a different type
func GetUint32Slice ¶
GetUint32Slice returns the []uint32 value associated with the given name from the FlagSet. It will exit with code 1 if:
- flag does not exist
- flag value is nil
- flag value has a different type
func GetUint32SlicePtr ¶
GetUint32SlicePtr returns a pointer to a []uint32 value associated with the given name from the FlagSet. If the flag value is not set, it returns nil. It will exit with code 1 if:
- flag does not exist
- flag value has a different type
func GetUint64 ¶
GetUint64 returns the uint64 value associated with the given name from the FlagSet. It will exit with code 1 if:
- flag does not exist
- flag value is nil
- flag value has a different type
func GetUint64Ptr ¶
GetUint64Ptr returns a pointer to an uint64 value associated with the given name from the FlagSet. If the flag value is not set, it returns nil. It will exit with code 1 if:
- flag does not exist
- flag value has a different type
func GetUint64Slice ¶
GetUint64Slice returns the []uint64 value associated with the given name from the FlagSet. It will exit with code 1 if:
- flag does not exist
- flag value is nil
- flag value has a different type
func GetUint64SlicePtr ¶
GetUint64SlicePtr returns a pointer to a []uint64 value associated with the given name from the FlagSet. If the flag value is not set, it returns nil. It will exit with code 1 if:
- flag does not exist
- flag value has a different type
func GetUint8 ¶
GetUint8 returns the uint8 value associated with the given name from the FlagSet. It will exit with code 1 if:
- flag does not exist
- flag value is nil
- flag value has a different type
func GetUint8Ptr ¶
GetUint8Ptr returns a pointer to an uint8 value associated with the given name from the FlagSet. If the flag value is not set, it returns nil. It will exit with code 1 if:
- flag does not exist
- flag value has a different type
func GetUint8Slice ¶
GetUint8Slice returns the []uint8 value associated with the given name from the FlagSet. It will exit with code 1 if:
- flag does not exist
- flag value is nil
- flag value has a different type
func GetUint8SlicePtr ¶
GetUint8SlicePtr returns a pointer to a []uint8 value associated with the given name from the FlagSet. If the flag value is not set, it returns nil. It will exit with code 1 if:
- flag does not exist
- flag value has a different type
func GetUintPtr ¶
GetUintPtr returns a pointer to an uint value associated with the given name from the FlagSet. If the flag value is not set, it returns nil. It will exit with code 1 if:
- flag does not exist
- flag value has a different type
func GetUintSlice ¶
GetUintSlice returns the []uint value associated with the given name from the FlagSet. It will exit with code 1 if:
- flag does not exist
- flag value is nil
- flag value has a different type
func GetUintSlicePtr ¶
GetUintSlicePtr returns a pointer to a []uint value associated with the given name from the FlagSet. If the flag value is not set, it returns nil. It will exit with code 1 if:
- flag does not exist
- flag value has a different type
Types ¶
type FlagSet ¶
type FlagSet struct {
// contains filtered or unexported fields
}
func (*FlagSet) BindEnvVars ¶
BindEnvVars binds environment variables to the corresponding flags in the FlagSet. It constructs a VarNameConstructor using the provided characters 'charOld' and 'charNew' and the environment options in the FlagSet. For each flag in the FlagSet, it retrieves the value of the environment variable using the VarNameConstructor and calls the FromEnvVariable method of the flag. If an error occurs during parsing, it is joined with the previous errors using the errors.Join function. The function returns the error encountered during parsing, if any.