config

package
v0.0.0-...-6a58249 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SourceIdent = "FSDS_CONFIG_APPIUM_ENV"
	BackupIdent = "FSDS_CONFIG_APPIUM_ENV_BACKUP"
	TmpCfgIdent = "FSDS_CONFIG_APPIUM_ENV_TEMP"
)
View Source
const (
	DefaultiPadSim  = "generic/platform=iOS"
	DefaultEnvQuote = '\''
)

Variables

This section is empty.

Functions

func Backup

func Backup(source, backup string) error

func Filter

func Filter[T any](seq iter.Seq[T], keep func(T) bool) []T

func LookupBackup

func LookupBackup(source string) (string, error)

func LookupSource

func LookupSource() (string, error)

func LookupTempConfig

func LookupTempConfig(base, name string) (string, error)

Types

type Env

type Env []*Var

func DefaultEnv

func DefaultEnv() Env

func (Env) Get

func (e Env) Get(want func(*Var) bool) (*Var, bool)

func (Env) Override

func (e Env) Override(orphan, zero bool) Env

Override will replace values in the configuration envionment according to the policy given by command-line flags --orphan and --zero.

func (Env) Sort

func (e Env) Sort(o Order) Env

func (Env) Usage

func (e Env) Usage(program, version string, flag ...*Var) func()

type Model

type Model struct {
	Env      Env
	EnvQuote rune
	Orphan   bool
	Zero     bool
}

func (*Model) ApplyToFlags

func (m *Model) ApplyToFlags(visit func(func(f *flag.Flag)), apply func(*Var) bool) bool

func (*Model) Init

func (m *Model) Init() error

func (*Model) String

func (m *Model) String() string

func (*Model) TargetSimulatorFlagHandler

func (m *Model) TargetSimulatorFlagHandler() func(string) error

func (*Model) Validate

func (m *Model) Validate() error

func (*Model) Write

func (m *Model) Write(out io.Writer, footer ...string) error

type Order

type Order func(a, b *Var) int

type Type

type Type int
const (
	Invalid Type = iota
	Bool
	Int
	Float
	String
	JSON
	Serial
)

func ParseType

func ParseType(s string) Type

func (Type) String

func (t Type) String() string

type Var

type Var struct {
	Flag     string // long flag ("--flag")
	PFlag    string // short flag ("-f")
	Ident    string
	Comment  []string
	VType    Type
	Aggr     bool
	UserDef  bool
	Zero     bool
	Orphan   bool
	Value    any
	EnvValue any
}

func NewAggregrateVar

func NewAggregrateVar(long, short, ident string, t Type, comment ...string) *Var

func NewVar

func NewVar(long, short, ident string, t Type, value any, comment ...string) *Var

func (*Var) IsBoolFlag

func (v *Var) IsBoolFlag() bool

func (*Var) Set

func (v *Var) Set(s string) error

func (*Var) String

func (v *Var) String() string

func (*Var) Type

func (v *Var) Type() string

func (*Var) Usage

func (v *Var) Usage() string

Jump to

Keyboard shortcuts

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