Documentation
¶
Index ¶
- type Scope
- func (s *Scope) AddBoundOptions(opts any)
- func (s *Scope) AddDefinedFlag(name, fieldPath string) error
- func (s *Scope) BoundOptions() []any
- func (s *Scope) ClearBoundEnv(flagName string)
- func (s *Scope) ConfigViper() *spf13viper.Viper
- func (s *Scope) GetBoundEnvs() map[string]bool
- func (s *Scope) GetCustomDecodeHook(hookName string) (hookFunc mapstructure.DecodeHookFunc, ok bool)
- func (s *Scope) IsEnvBound(flagName string) bool
- func (s *Scope) ResetConfigViper()
- func (s *Scope) SetBound(flagName string)
- func (s *Scope) SetCustomDecodeHook(hookName string, hookFunc mapstructure.DecodeHookFunc)
- func (s *Scope) Viper() *spf13viper.Viper
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Scope ¶
type Scope struct {
// contains filtered or unexported fields
}
Scope holds per-command state for structcli
func (*Scope) AddBoundOptions ¶ added in v0.17.0
AddBoundOptions appends an options struct to the ordered list of bound options for this command. Unmarshal order matches call order (FIFO).
func (*Scope) AddDefinedFlag ¶
AddDefinedFlag adds a flag to the set of defined flags for this scope, returning an error if it's a duplicate.
func (*Scope) BoundOptions ¶ added in v0.17.0
BoundOptions returns a copy of the ordered list of bound options for this command.
func (*Scope) ClearBoundEnv ¶ added in v0.17.0
ClearBoundEnv removes the bound marker for a single flag so that BindEnv will re-bind it on the next call. Used by env annotation patching when WithAppName retroactively updates env var names.
func (*Scope) ConfigViper ¶ added in v0.10.0
func (s *Scope) ConfigViper() *spf13viper.Viper
ConfigViper returns the dedicated viper instance used for config-file loading.
func (*Scope) GetBoundEnvs ¶
GetBoundEnvs is for testing purposes only
func (*Scope) GetCustomDecodeHook ¶
func (s *Scope) GetCustomDecodeHook(hookName string) (hookFunc mapstructure.DecodeHookFunc, ok bool)
func (*Scope) IsEnvBound ¶
IsEnvBound checks if an environment variable is already bound for this command
func (*Scope) ResetConfigViper ¶ added in v0.10.0
func (s *Scope) ResetConfigViper()
ResetConfigViper clears config-file state for the scope while preserving other scope data.
func (*Scope) SetCustomDecodeHook ¶
func (s *Scope) SetCustomDecodeHook(hookName string, hookFunc mapstructure.DecodeHookFunc)
func (*Scope) Viper ¶
func (s *Scope) Viper() *spf13viper.Viper
Viper returns the viper instance for the command