Documentation
¶
Index ¶
- Constants
- Variables
- func GetTypeText(value interface{}) string
- func StrToPtr(v string) *string
- type Argument
- type ArgumentTyped
- type BoolArg
- type BoolFlag
- type Command
- func (c *Command) Execute(ctx context.Context) error
- func (c *Command) GetArgs() []string
- func (c *Command) GetBool(name string) bool
- func (c *Command) GetBoolArg(name string) bool
- func (c *Command) GetFloat32(name string) float32
- func (c *Command) GetFloat32Arg(name string) float32
- func (c *Command) GetFloat32Slice(name string) []float32
- func (c *Command) GetFloat64(name string) float64
- func (c *Command) GetFloat64Arg(name string) float64
- func (c *Command) GetFloat64Slice(name string) []float64
- func (c *Command) GetInt(name string) int
- func (c *Command) GetInt16(name string) int16
- func (c *Command) GetInt16Arg(name string) int16
- func (c *Command) GetInt16Slice(name string) []int16
- func (c *Command) GetInt32(name string) int32
- func (c *Command) GetInt32Arg(name string) int32
- func (c *Command) GetInt32Slice(name string) []int32
- func (c *Command) GetInt64(name string) int64
- func (c *Command) GetInt64Arg(name string) int64
- func (c *Command) GetInt64Slice(name string) []int64
- func (c *Command) GetInt8(name string) int8
- func (c *Command) GetInt8Arg(name string) int8
- func (c *Command) GetInt8Slice(name string) []int8
- func (c *Command) GetIntArg(name string) int
- func (c *Command) GetIntSlice(name string) []int
- func (c *Command) GetRootCmd() *Command
- func (c *Command) GetString(name string) string
- func (c *Command) GetStringArg(name string) string
- func (c *Command) GetStringSlice(name string) []string
- func (c *Command) GetUint(name string) uint
- func (c *Command) GetUint16(name string) uint16
- func (c *Command) GetUint16Arg(name string) uint16
- func (c *Command) GetUint16Slice(name string) []uint16
- func (c *Command) GetUint32(name string) uint32
- func (c *Command) GetUint32Arg(name string) uint32
- func (c *Command) GetUint32Slice(name string) []uint32
- func (c *Command) GetUint64(name string) uint64
- func (c *Command) GetUint64Arg(name string) uint64
- func (c *Command) GetUint64Slice(name string) []uint64
- func (c *Command) GetUint8(name string) uint8
- func (c *Command) GetUint8Arg(name string) uint8
- func (c *Command) GetUint8Slice(name string) []uint8
- func (c *Command) GetUintArg(name string) uint
- func (c *Command) GetUintSlice(name string) []uint
- func (c *Command) HasArg(name string) bool
- func (c *Command) HasFlag(name string) bool
- func (c *Command) ReloadFlags() error
- func (c *Command) ShowHelp()
- type ConfigFileBase
- func (c *ConfigFileBase) DeleteKey(path string) error
- func (c *ConfigFileBase) FileUsed() string
- func (c *ConfigFileBase) GetKeys(path string) []string
- func (c *ConfigFileBase) GetValue(path string) (any, bool)
- func (c *ConfigFileBase) InitConfigFile()
- func (c *ConfigFileBase) LoadData() error
- func (c *ConfigFileBase) OnChange(handler ConfigFileChangeHandler) error
- func (c *ConfigFileBase) Save() error
- func (c *ConfigFileBase) SetValue(path string, value any) error
- type ConfigFileChangeHandler
- type ConfigFileMarshal
- type ConfigFileSource
- type ConfigFileTyped
- type ConfigFileTypedWrapper
- func (w *ConfigFileTypedWrapper) DeleteKey(path string) error
- func (w *ConfigFileTypedWrapper) FileUsed() string
- func (c *ConfigFileTypedWrapper) GetBool(path string) bool
- func (c *ConfigFileTypedWrapper) GetFloat32(path string) float32
- func (c *ConfigFileTypedWrapper) GetFloat32Slice(path string) []float32
- func (c *ConfigFileTypedWrapper) GetFloat64(path string) float64
- func (c *ConfigFileTypedWrapper) GetFloat64Slice(path string) []float64
- func (c *ConfigFileTypedWrapper) GetInt(path string) int
- func (c *ConfigFileTypedWrapper) GetInt16(path string) int16
- func (c *ConfigFileTypedWrapper) GetInt16Slice(path string) []int16
- func (c *ConfigFileTypedWrapper) GetInt32(path string) int32
- func (c *ConfigFileTypedWrapper) GetInt32Slice(path string) []int32
- func (c *ConfigFileTypedWrapper) GetInt64(path string) int64
- func (c *ConfigFileTypedWrapper) GetInt64Slice(path string) []int64
- func (c *ConfigFileTypedWrapper) GetInt8(path string) int8
- func (c *ConfigFileTypedWrapper) GetInt8Slice(path string) []int8
- func (c *ConfigFileTypedWrapper) GetIntSlice(path string) []int
- func (w *ConfigFileTypedWrapper) GetKeys(path string) []string
- func (c *ConfigFileTypedWrapper) GetObject(path string) ConfigFileTyped
- func (c *ConfigFileTypedWrapper) GetObjectSlice(path string) []ConfigFileTyped
- func (c *ConfigFileTypedWrapper) GetString(path string) string
- func (c *ConfigFileTypedWrapper) GetStringSlice(path string) []string
- func (c *ConfigFileTypedWrapper) GetUint(path string) uint
- func (c *ConfigFileTypedWrapper) GetUint16(path string) uint16
- func (c *ConfigFileTypedWrapper) GetUint16Slice(path string) []uint16
- func (c *ConfigFileTypedWrapper) GetUint32(path string) uint32
- func (c *ConfigFileTypedWrapper) GetUint32Slice(path string) []uint32
- func (c *ConfigFileTypedWrapper) GetUint64(path string) uint64
- func (c *ConfigFileTypedWrapper) GetUint64Slice(path string) []uint64
- func (c *ConfigFileTypedWrapper) GetUint8(path string) uint8
- func (c *ConfigFileTypedWrapper) GetUint8Slice(path string) []uint8
- func (c *ConfigFileTypedWrapper) GetUintSlice(path string) []uint
- func (w *ConfigFileTypedWrapper) GetValue(path string) (any, bool)
- func (c *ConfigFileTypedWrapper) LoadData() error
- func (w *ConfigFileTypedWrapper) OnChange(h ConfigFileChangeHandler) error
- func (w *ConfigFileTypedWrapper) Save() error
- func (c *ConfigFileTypedWrapper) SetBool(path string, value bool) error
- func (c *ConfigFileTypedWrapper) SetFloat32(path string, value float32) error
- func (c *ConfigFileTypedWrapper) SetFloat32Slice(path string, value []float32) error
- func (c *ConfigFileTypedWrapper) SetFloat64(path string, value float64) error
- func (c *ConfigFileTypedWrapper) SetFloat64Slice(path string, value []float64) error
- func (c *ConfigFileTypedWrapper) SetInt(path string, value int) error
- func (c *ConfigFileTypedWrapper) SetInt16(path string, value int16) error
- func (c *ConfigFileTypedWrapper) SetInt16Slice(path string, value []int16) error
- func (c *ConfigFileTypedWrapper) SetInt32(path string, value int32) error
- func (c *ConfigFileTypedWrapper) SetInt32Slice(path string, value []int32) error
- func (c *ConfigFileTypedWrapper) SetInt64(path string, value int64) error
- func (c *ConfigFileTypedWrapper) SetInt64Slice(path string, value []int64) error
- func (c *ConfigFileTypedWrapper) SetInt8(path string, value int8) error
- func (c *ConfigFileTypedWrapper) SetInt8Slice(path string, value []int8) error
- func (c *ConfigFileTypedWrapper) SetIntSlice(path string, value []int) error
- func (c *ConfigFileTypedWrapper) SetObject(path string, obj ConfigFileTyped) error
- func (c *ConfigFileTypedWrapper) SetObjectSlice(path string, objects []ConfigFileTyped) error
- func (c *ConfigFileTypedWrapper) SetString(path string, value string) error
- func (c *ConfigFileTypedWrapper) SetStringSlice(path string, value []string) error
- func (c *ConfigFileTypedWrapper) SetUint(path string, value uint) error
- func (c *ConfigFileTypedWrapper) SetUint16(path string, value uint16) error
- func (c *ConfigFileTypedWrapper) SetUint16Slice(path string, value []uint16) error
- func (c *ConfigFileTypedWrapper) SetUint32(path string, value uint32) error
- func (c *ConfigFileTypedWrapper) SetUint32Slice(path string, value []uint32) error
- func (c *ConfigFileTypedWrapper) SetUint64(path string, value uint64) error
- func (c *ConfigFileTypedWrapper) SetUint64Slice(path string, value []uint64) error
- func (c *ConfigFileTypedWrapper) SetUint8(path string, value uint8) error
- func (c *ConfigFileTypedWrapper) SetUint8Slice(path string, value []uint8) error
- func (c *ConfigFileTypedWrapper) SetUintSlice(path string, value []uint) error
- func (w *ConfigFileTypedWrapper) SetValue(path string, v any) error
- type ConfigFileUnmarshal
- type Flag
- type FlagTyped
- type Float32Arg
- type Float32Flag
- type Float32SliceFlag
- type Float64Arg
- type Float64Flag
- type Float64SliceFlag
- type Int16Arg
- type Int16Flag
- type Int16SliceFlag
- type Int32Arg
- type Int32Flag
- type Int32SliceFlag
- type Int64Arg
- type Int64Flag
- type Int64SliceFlag
- type Int8Arg
- type Int8Flag
- type Int8SliceFlag
- type IntArg
- type IntFlag
- type IntSliceFlag
- type SearchPathFunc
- type StringArg
- type StringFlag
- type StringSliceFlag
- type Uint16Arg
- type Uint16Flag
- type Uint16SliceFlag
- type Uint32Arg
- type Uint32Flag
- type Uint32SliceFlag
- type Uint64Arg
- type Uint64Flag
- type Uint64SliceFlag
- type Uint8Arg
- type Uint8Flag
- type Uint8SliceFlag
- type UintArg
- type UintFlag
- type UintSliceFlag
Constants ¶
const ( NoArgs = 0 // No unnamed arguments allowed UnlimitedArgs = -1 // Unlimited unnamed arguments allowed )
Variables ¶
var (
ConfigFileNotFoundError = fmt.Errorf("configuration file not found")
)
Functions ¶
func GetTypeText ¶
func GetTypeText(value interface{}) string
GetTypeText returns a string representation of a type for help text display
Types ¶
type ArgumentTyped ¶
type ArgumentTyped[T any] struct { Name string // Name of the argument Usage string // Usage description for the argument Required bool // Whether this flag is required AssignTo *T // Optional pointer to the variable where the value should be stored ValidateArg func(*Command) error // Optional validation for the argument }
type BoolArg ¶
type BoolArg = ArgumentTyped[bool]
type Command ¶
type Command struct {
Name string // Name of the command, e.g. "server", "config", etc.
Version string // Version of the command, e.g. "1.0.0"
Usage string // Short description of the command, e.g. "Start the server", "Show config", etc.
Description string // Longer description of the command, e.g. "This command starts the server with the given configuration", "This command shows the current configuration", etc.
Flags []Flag // Flags that are available for this command only
Arguments []Argument // Arguments that can be passed to this command, e.g. "server start <config-file>", "config show <section>", etc.
MinArgs int // Minimum number of unnamed arguments that are required for this command e.g. 0 for no minimum.
MaxArgs int // Maximum number of unnamed arguments that are allowed for this command e.g. 0 for no arguments, -1 for unlimited, or a specific number like 2 for "server start <config-file> <port>
ConfigFile ConfigFileSource // Configuration file reader.
Commands []*Command // Subcommands that can be executed under this command, e.g. "server start", "server stop", etc.
Run func(ctx context.Context, cmd *Command) error // Function to run when this command is executed, e.g. to start the server, show the config, etc.
PreRun func(ctx context.Context, cmd *Command) (context.Context, error) // Function to run before any command is executed, e.g. to set up logging, read config files, etc.
PostRun func(ctx context.Context, cmd *Command) error // Function to run after any command is executed, e.g. to clean up resources, log the result, etc.
DisableHelp bool // Disable the automatic help command for this command
DisableVersion bool // Disable the automatic version command for this command
Suggestions bool // Enable suggestions for unknown commands, if true then the command will try to suggest similar commands if the command is not found
// contains filtered or unexported fields
}
func GenerateCompletionCommand ¶
func GenerateCompletionCommand() *Command
GenerateCompletionCommand creates a new command that outputs shell completion scripts
func (*Command) GetArgs ¶
Args returns the list of arguments that were passed to the command and have not been consumed by subcommands, flags and arguments
func (*Command) GetBoolArg ¶
func (*Command) GetFloat32 ¶
func (*Command) GetFloat32Arg ¶
func (*Command) GetFloat32Slice ¶
func (*Command) GetFloat64 ¶
func (*Command) GetFloat64Arg ¶
func (*Command) GetFloat64Slice ¶
func (*Command) GetInt16Arg ¶
func (*Command) GetInt16Slice ¶
func (*Command) GetInt32Arg ¶
func (*Command) GetInt32Slice ¶
func (*Command) GetInt64Arg ¶
func (*Command) GetInt64Slice ¶
func (*Command) GetInt8Arg ¶
func (*Command) GetInt8Slice ¶
func (*Command) GetIntSlice ¶
func (*Command) GetRootCmd ¶
func (*Command) GetStringSlice ¶
Slice getters
func (*Command) GetUint16Arg ¶
func (*Command) GetUint16Slice ¶
func (*Command) GetUint32Arg ¶
func (*Command) GetUint32Slice ¶
func (*Command) GetUint64Arg ¶
func (*Command) GetUint64Slice ¶
func (*Command) GetUint8Arg ¶
func (*Command) GetUint8Slice ¶
func (*Command) GetUintArg ¶
func (*Command) GetUintSlice ¶
func (*Command) ReloadFlags ¶
type ConfigFileBase ¶
type ConfigFileBase struct {
FileName *string // Point to the configuration file name
SearchPath SearchPathFunc // Function to define the search paths for the config file
Unmarshal ConfigFileUnmarshal // Function to decode the configuration file content
Marshal ConfigFileMarshal // Function to encode the configuration file content
// contains filtered or unexported fields
}
func (*ConfigFileBase) DeleteKey ¶
func (c *ConfigFileBase) DeleteKey(path string) error
func (*ConfigFileBase) FileUsed ¶
func (c *ConfigFileBase) FileUsed() string
func (*ConfigFileBase) GetKeys ¶
func (c *ConfigFileBase) GetKeys(path string) []string
func (*ConfigFileBase) InitConfigFile ¶
func (c *ConfigFileBase) InitConfigFile()
func (*ConfigFileBase) LoadData ¶
func (c *ConfigFileBase) LoadData() error
func (*ConfigFileBase) OnChange ¶
func (c *ConfigFileBase) OnChange(handler ConfigFileChangeHandler) error
func (*ConfigFileBase) Save ¶
func (c *ConfigFileBase) Save() error
type ConfigFileChangeHandler ¶
type ConfigFileChangeHandler func()
type ConfigFileMarshal ¶
type ConfigFileSource ¶
type ConfigFileSource interface {
GetValue(string) (any, bool) // Get the value from the configuration file at the specified path.
GetKeys(string) []string // Get the keys from the configuration file at the specified path.
SetValue(string, any) error // Set a value in the configuration file at the specified path.
DeleteKey(string) error // Delete a key from the configuration file at the specified path.
Save() error // Save the configuration file.
OnChange(ConfigFileChangeHandler) error // Track changes to the configuration file.
FileUsed() string // Get the file used for the configuration.
LoadData() error // Load the configuration data from the file.
}
type ConfigFileTyped ¶
type ConfigFileTyped interface {
ConfigFileSource
GetString(string) string // Get the string value from the configuration file at the specified path.
GetInt(string) int // Get the int value from the configuration file at the specified path.
GetInt64(string) int64 // Get the int64 value from the configuration file at the specified path.
GetInt32(string) int32 // Get the int32 value from the configuration file at the specified path.
GetInt16(string) int16 // Get the int16 value from the configuration file at the specified path.
GetInt8(string) int8 // Get the int8 value from the configuration file at the specified path.
GetUint(string) uint // Get the uint value from the configuration file at the specified path.
GetUint64(string) uint64 // Get the uint64 value from the configuration file at the specified path.
GetUint32(string) uint32 // Get the uint32 value from the configuration file at the specified path.
GetUint16(string) uint16 // Get the uint16 value from the configuration file at the specified path.
GetUint8(string) uint8 // Get the uint8 value from the configuration file at the specified path.
GetFloat32(string) float32 // Get the float32 value from the configuration file at the specified path.
GetFloat64(string) float64 // Get the float64 value from the configuration file at the specified path.
GetBool(string) bool // Get the bool value from the configuration file at the specified path.
GetStringSlice(string) []string // Get the string slice value from the configuration file at the specified path.
GetIntSlice(string) []int // Get the int slice value from the configuration file at the specified path.
GetInt64Slice(string) []int64 // Get the int64 slice value from the configuration file at the specified path.
GetInt32Slice(string) []int32 // Get the int32 slice value from the configuration file at the specified path.
GetInt16Slice(string) []int16 // Get the int16 slice value from the configuration file at the specified path.
GetInt8Slice(string) []int8 // Get the int8 slice value from the configuration file at the specified path.
GetUintSlice(string) []uint // Get the uint slice value from the configuration file at the specified path.
GetUint64Slice(string) []uint64 // Get the uint64 slice value from the configuration file at the specified path.
GetUint32Slice(string) []uint32 // Get the uint32 slice value from the configuration file at the specified path.
GetUint16Slice(string) []uint16 // Get the uint16 slice value from the configuration file at the specified path.
GetUint8Slice(string) []uint8 // Get the uint8 slice value from the configuration file at the specified path.
GetFloat32Slice(string) []float32 // Get the float32 slice value from the configuration file at the specified path.
GetFloat64Slice(string) []float64 // Get the float64 slice value from the configuration file at the specified path.
SetString(string, string) error // Set the string value in the configuration file at the specified path.
SetInt(string, int) error // Set the int value in the configuration file at the specified path.
SetInt64(string, int64) error // Set the int64 value in the configuration file at the specified path.
SetInt32(string, int32) error // Set the int32 value in the configuration file at the specified path.
SetInt16(string, int16) error // Set the int16 value in the configuration file at the specified path.
SetInt8(string, int8) error // Set the int8 value in the configuration file at the specified path.
SetUint(string, uint) error // Set the uint value in the configuration file at the specified path.
SetUint64(string, uint64) error // Set the uint64 value in the configuration file at the specified path.
SetUint32(string, uint32) error // Set the uint32 value in the configuration file at the specified path.
SetUint16(string, uint16) error // Set the uint16 value in the configuration file at the specified path.
SetUint8(string, uint8) error // Set the uint8 value in the configuration file at the specified path.
SetFloat32(string, float32) error // Set the float32 value in the configuration file at the specified path.
SetFloat64(string, float64) error // Set the float64 value in the configuration file at the specified path.
SetBool(string, bool) error // Set the bool value in the configuration file at the specified path.
SetStringSlice(string, []string) error // Set the string slice value in the configuration file at the specified path.
SetIntSlice(string, []int) error // Set the int slice value in the configuration file at the specified path.
SetInt64Slice(string, []int64) error // Set the int64 slice value in the configuration file at the specified path.
SetInt32Slice(string, []int32) error // Set the int32 slice value in the configuration file at the specified path.
SetInt16Slice(string, []int16) error // Set the int16 slice value in the configuration file at the specified path.
SetInt8Slice(string, []int8) error // Set the int8 slice value in the configuration file at the specified path.
SetUintSlice(string, []uint) error // Set the uint slice value in the configuration file at the specified path.
SetUint64Slice(string, []uint64) error // Set the uint64 slice value in the configuration file at the specified path.
SetUint32Slice(string, []uint32) error // Set the uint32 slice value in the configuration file at the specified path.
SetUint16Slice(string, []uint16) error // Set the uint16 slice value in the configuration file at the specified path.
SetUint8Slice(string, []uint8) error // Set the uint8 slice value in the configuration file at the specified path.
SetFloat32Slice(string, []float32) error // Set the float32 slice value in the configuration file at the specified path.
SetFloat64Slice(string, []float64) error // Set the float64 slice value in the configuration file at the specified path.
// Object getters
GetObjectSlice(string) []ConfigFileTyped // Get a slice of objects from the configuration file at the specified path.
GetObject(string) ConfigFileTyped // Get a single object from the configuration file at the specified path.
// Object setters
SetObjectSlice(string, []ConfigFileTyped) error // Set a slice of objects in the configuration file at the specified path.
SetObject(string, ConfigFileTyped) error // Set an object in the configuration file at the specified path.
}
func NewTypedConfigObject ¶ added in v0.6.0
func NewTypedConfigObject() ConfigFileTyped
NewTypedConfigObject creates a new empty ConfigFileTyped instance that can be used for setting objects This returns a ConfigFileTyped wrapped around an empty map that you can populate and then set
func NewTypedConfigObjectWithData ¶ added in v0.6.0
func NewTypedConfigObjectWithData(data map[string]any) ConfigFileTyped
NewTypedConfigObjectWithData creates a new ConfigFileTyped instance from a map[string]any
type ConfigFileTypedWrapper ¶
type ConfigFileTypedWrapper struct {
// contains filtered or unexported fields
}
func NewTypedConfigFile ¶
func NewTypedConfigFile(inner ConfigFileSource) *ConfigFileTypedWrapper
func (*ConfigFileTypedWrapper) DeleteKey ¶
func (w *ConfigFileTypedWrapper) DeleteKey(path string) error
func (*ConfigFileTypedWrapper) FileUsed ¶
func (w *ConfigFileTypedWrapper) FileUsed() string
func (*ConfigFileTypedWrapper) GetBool ¶
func (c *ConfigFileTypedWrapper) GetBool(path string) bool
func (*ConfigFileTypedWrapper) GetFloat32 ¶
func (c *ConfigFileTypedWrapper) GetFloat32(path string) float32
func (*ConfigFileTypedWrapper) GetFloat32Slice ¶
func (c *ConfigFileTypedWrapper) GetFloat32Slice(path string) []float32
func (*ConfigFileTypedWrapper) GetFloat64 ¶
func (c *ConfigFileTypedWrapper) GetFloat64(path string) float64
func (*ConfigFileTypedWrapper) GetFloat64Slice ¶
func (c *ConfigFileTypedWrapper) GetFloat64Slice(path string) []float64
func (*ConfigFileTypedWrapper) GetInt ¶
func (c *ConfigFileTypedWrapper) GetInt(path string) int
func (*ConfigFileTypedWrapper) GetInt16 ¶
func (c *ConfigFileTypedWrapper) GetInt16(path string) int16
func (*ConfigFileTypedWrapper) GetInt16Slice ¶
func (c *ConfigFileTypedWrapper) GetInt16Slice(path string) []int16
func (*ConfigFileTypedWrapper) GetInt32 ¶
func (c *ConfigFileTypedWrapper) GetInt32(path string) int32
func (*ConfigFileTypedWrapper) GetInt32Slice ¶
func (c *ConfigFileTypedWrapper) GetInt32Slice(path string) []int32
func (*ConfigFileTypedWrapper) GetInt64 ¶
func (c *ConfigFileTypedWrapper) GetInt64(path string) int64
func (*ConfigFileTypedWrapper) GetInt64Slice ¶
func (c *ConfigFileTypedWrapper) GetInt64Slice(path string) []int64
func (*ConfigFileTypedWrapper) GetInt8 ¶
func (c *ConfigFileTypedWrapper) GetInt8(path string) int8
func (*ConfigFileTypedWrapper) GetInt8Slice ¶
func (c *ConfigFileTypedWrapper) GetInt8Slice(path string) []int8
func (*ConfigFileTypedWrapper) GetIntSlice ¶
func (c *ConfigFileTypedWrapper) GetIntSlice(path string) []int
func (*ConfigFileTypedWrapper) GetKeys ¶
func (w *ConfigFileTypedWrapper) GetKeys(path string) []string
func (*ConfigFileTypedWrapper) GetObject ¶ added in v0.6.0
func (c *ConfigFileTypedWrapper) GetObject(path string) ConfigFileTyped
func (*ConfigFileTypedWrapper) GetObjectSlice ¶ added in v0.6.0
func (c *ConfigFileTypedWrapper) GetObjectSlice(path string) []ConfigFileTyped
func (*ConfigFileTypedWrapper) GetString ¶
func (c *ConfigFileTypedWrapper) GetString(path string) string
func (*ConfigFileTypedWrapper) GetStringSlice ¶
func (c *ConfigFileTypedWrapper) GetStringSlice(path string) []string
func (*ConfigFileTypedWrapper) GetUint ¶
func (c *ConfigFileTypedWrapper) GetUint(path string) uint
func (*ConfigFileTypedWrapper) GetUint16 ¶
func (c *ConfigFileTypedWrapper) GetUint16(path string) uint16
func (*ConfigFileTypedWrapper) GetUint16Slice ¶
func (c *ConfigFileTypedWrapper) GetUint16Slice(path string) []uint16
func (*ConfigFileTypedWrapper) GetUint32 ¶
func (c *ConfigFileTypedWrapper) GetUint32(path string) uint32
func (*ConfigFileTypedWrapper) GetUint32Slice ¶
func (c *ConfigFileTypedWrapper) GetUint32Slice(path string) []uint32
func (*ConfigFileTypedWrapper) GetUint64 ¶
func (c *ConfigFileTypedWrapper) GetUint64(path string) uint64
func (*ConfigFileTypedWrapper) GetUint64Slice ¶
func (c *ConfigFileTypedWrapper) GetUint64Slice(path string) []uint64
func (*ConfigFileTypedWrapper) GetUint8 ¶
func (c *ConfigFileTypedWrapper) GetUint8(path string) uint8
func (*ConfigFileTypedWrapper) GetUint8Slice ¶
func (c *ConfigFileTypedWrapper) GetUint8Slice(path string) []uint8
func (*ConfigFileTypedWrapper) GetUintSlice ¶
func (c *ConfigFileTypedWrapper) GetUintSlice(path string) []uint
func (*ConfigFileTypedWrapper) GetValue ¶
func (w *ConfigFileTypedWrapper) GetValue(path string) (any, bool)
func (*ConfigFileTypedWrapper) LoadData ¶ added in v0.2.0
func (c *ConfigFileTypedWrapper) LoadData() error
func (*ConfigFileTypedWrapper) OnChange ¶
func (w *ConfigFileTypedWrapper) OnChange(h ConfigFileChangeHandler) error
func (*ConfigFileTypedWrapper) Save ¶
func (w *ConfigFileTypedWrapper) Save() error
func (*ConfigFileTypedWrapper) SetBool ¶
func (c *ConfigFileTypedWrapper) SetBool(path string, value bool) error
func (*ConfigFileTypedWrapper) SetFloat32 ¶
func (c *ConfigFileTypedWrapper) SetFloat32(path string, value float32) error
func (*ConfigFileTypedWrapper) SetFloat32Slice ¶
func (c *ConfigFileTypedWrapper) SetFloat32Slice(path string, value []float32) error
func (*ConfigFileTypedWrapper) SetFloat64 ¶
func (c *ConfigFileTypedWrapper) SetFloat64(path string, value float64) error
func (*ConfigFileTypedWrapper) SetFloat64Slice ¶
func (c *ConfigFileTypedWrapper) SetFloat64Slice(path string, value []float64) error
func (*ConfigFileTypedWrapper) SetInt ¶
func (c *ConfigFileTypedWrapper) SetInt(path string, value int) error
func (*ConfigFileTypedWrapper) SetInt16 ¶
func (c *ConfigFileTypedWrapper) SetInt16(path string, value int16) error
func (*ConfigFileTypedWrapper) SetInt16Slice ¶
func (c *ConfigFileTypedWrapper) SetInt16Slice(path string, value []int16) error
func (*ConfigFileTypedWrapper) SetInt32 ¶
func (c *ConfigFileTypedWrapper) SetInt32(path string, value int32) error
func (*ConfigFileTypedWrapper) SetInt32Slice ¶
func (c *ConfigFileTypedWrapper) SetInt32Slice(path string, value []int32) error
func (*ConfigFileTypedWrapper) SetInt64 ¶
func (c *ConfigFileTypedWrapper) SetInt64(path string, value int64) error
func (*ConfigFileTypedWrapper) SetInt64Slice ¶
func (c *ConfigFileTypedWrapper) SetInt64Slice(path string, value []int64) error
func (*ConfigFileTypedWrapper) SetInt8 ¶
func (c *ConfigFileTypedWrapper) SetInt8(path string, value int8) error
func (*ConfigFileTypedWrapper) SetInt8Slice ¶
func (c *ConfigFileTypedWrapper) SetInt8Slice(path string, value []int8) error
func (*ConfigFileTypedWrapper) SetIntSlice ¶
func (c *ConfigFileTypedWrapper) SetIntSlice(path string, value []int) error
func (*ConfigFileTypedWrapper) SetObject ¶ added in v0.6.0
func (c *ConfigFileTypedWrapper) SetObject(path string, obj ConfigFileTyped) error
SetObject sets an object at the specified path. The object parameter should be a ConfigFileTyped instance that contains the data to set.
func (*ConfigFileTypedWrapper) SetObjectSlice ¶ added in v0.6.0
func (c *ConfigFileTypedWrapper) SetObjectSlice(path string, objects []ConfigFileTyped) error
SetObjectSlice sets a slice of objects at the specified path.
func (*ConfigFileTypedWrapper) SetString ¶
func (c *ConfigFileTypedWrapper) SetString(path string, value string) error
func (*ConfigFileTypedWrapper) SetStringSlice ¶
func (c *ConfigFileTypedWrapper) SetStringSlice(path string, value []string) error
func (*ConfigFileTypedWrapper) SetUint ¶
func (c *ConfigFileTypedWrapper) SetUint(path string, value uint) error
func (*ConfigFileTypedWrapper) SetUint16 ¶
func (c *ConfigFileTypedWrapper) SetUint16(path string, value uint16) error
func (*ConfigFileTypedWrapper) SetUint16Slice ¶
func (c *ConfigFileTypedWrapper) SetUint16Slice(path string, value []uint16) error
func (*ConfigFileTypedWrapper) SetUint32 ¶
func (c *ConfigFileTypedWrapper) SetUint32(path string, value uint32) error
func (*ConfigFileTypedWrapper) SetUint32Slice ¶
func (c *ConfigFileTypedWrapper) SetUint32Slice(path string, value []uint32) error
func (*ConfigFileTypedWrapper) SetUint64 ¶
func (c *ConfigFileTypedWrapper) SetUint64(path string, value uint64) error
func (*ConfigFileTypedWrapper) SetUint64Slice ¶
func (c *ConfigFileTypedWrapper) SetUint64Slice(path string, value []uint64) error
func (*ConfigFileTypedWrapper) SetUint8 ¶
func (c *ConfigFileTypedWrapper) SetUint8(path string, value uint8) error
func (*ConfigFileTypedWrapper) SetUint8Slice ¶
func (c *ConfigFileTypedWrapper) SetUint8Slice(path string, value []uint8) error
func (*ConfigFileTypedWrapper) SetUintSlice ¶
func (c *ConfigFileTypedWrapper) SetUintSlice(path string, value []uint) error
type ConfigFileUnmarshal ¶
type FlagTyped ¶
type FlagTyped[T any] struct { Name string // Name of the flag, e.g. "server" Usage string // Short description of the flag, e.g. "The server to connect to" Aliases []string // Aliases for the flag, e.g. "s" for "server" ConfigPath []string // Configuration paths for the flag, e.g. "cli.server" DefaultValue T // Default value for the flag, e.g. "localhost" for server DefaultText string // Text to show in usage as the default value, e.g. "localhost" AssignTo *T // Optional pointer to the variable where the value should be stored EnvVars []string // Environment variables that can be used to set this flag, first found will be used Required bool // Whether this flag is required Global bool // Whether this flag is global, i.e. available in all commands HideDefault bool // Whether to hide the default value in usage output HideType bool // Whether to hide the type in usage output Hidden bool // Whether this flag is hidden from help and command completions ValidateFlag func(*Command) error // Validation function for the flag }
type Float32Arg ¶
type Float32Arg = ArgumentTyped[float32]
type Float32Flag ¶
type Float32SliceFlag ¶
type Float64Arg ¶
type Float64Arg = ArgumentTyped[float64]
type Float64Flag ¶
type Float64SliceFlag ¶
type Int16Arg ¶
type Int16Arg = ArgumentTyped[int16]
type Int16SliceFlag ¶
type Int32Arg ¶
type Int32Arg = ArgumentTyped[int32]
type Int32SliceFlag ¶
type Int64Arg ¶
type Int64Arg = ArgumentTyped[int64]
type Int64SliceFlag ¶
type Int8Arg ¶
type Int8Arg = ArgumentTyped[int8]
type Int8SliceFlag ¶
type IntArg ¶
type IntArg = ArgumentTyped[int]
type IntSliceFlag ¶
type SearchPathFunc ¶
type SearchPathFunc func() []string
type StringArg ¶
type StringArg = ArgumentTyped[string]
type StringFlag ¶
type StringSliceFlag ¶
type Uint16Arg ¶
type Uint16Arg = ArgumentTyped[uint16]
type Uint16Flag ¶
type Uint16SliceFlag ¶
type Uint32Arg ¶
type Uint32Arg = ArgumentTyped[uint32]
type Uint32Flag ¶
type Uint32SliceFlag ¶
type Uint64Arg ¶
type Uint64Arg = ArgumentTyped[uint64]
type Uint64Flag ¶
type Uint64SliceFlag ¶
type Uint8Arg ¶
type Uint8Arg = ArgumentTyped[uint8]
type Uint8SliceFlag ¶
type UintArg ¶
type UintArg = ArgumentTyped[uint]