internalscope

package
v0.9.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 31, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

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 Get

func Get(c *cobra.Command) *Scope

Get retrieves or creates a scope for the given command

func (*Scope) AddDefinedFlag

func (s *Scope) AddDefinedFlag(name, fieldPath string) error

AddDefinedFlag adds a flag to the set of defined flags for this scope, returning an error if it's a duplicate.

func (*Scope) GetBoundEnvs

func (s *Scope) GetBoundEnvs() map[string]bool

GetBoundEnvs is for testing purposes only

func (*Scope) GetCustomDecodeHook

func (s *Scope) GetCustomDecodeHook(hookName string) (hookFunc mapstructure.DecodeHookFunc, ok bool)

func (*Scope) IsEnvBound

func (s *Scope) IsEnvBound(flagName string) bool

IsEnvBound checks if an environment variable is already bound for this command

func (*Scope) SetBound

func (s *Scope) SetBound(flagName string)

SetBound marks an environment variable as bound for this command

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL