config

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Bash       = "bash"
	Zsh        = "zsh"
	Fish       = "fish"
	Powershell = "powershell"

	Auto  = "auto"
	Color = "color"
	Plain = "plain"
	JSON  = "json"
)
View Source
const (
	InplaceFlag    = "inplace"
	ValueFlag      = "value"
	ValueFlagShort = "v"
	RecursiveFlag  = "recursive"
	PrefixFlag     = "prefix"
	LeftDelimFlag  = "left-delim"
	RightDelimFlag = "right-delim"
	IndentFlag     = "indent"
	StripFlag      = "strip"

	FailFlag                 = "fail"
	IgnoreUnsetErrorsFlag    = "ignore-unset-errors"
	IgnoreTemplateErrorsFlag = "ignore-template-errors"

	LogLevelFlag  = "log-level"
	LogFormatFlag = "log-format"

	CompletionFlag = "completion"
)
View Source
const EnvPrefix = "YAMPL_"

Variables

This section is empty.

Functions

func BoolCompletion added in v0.6.0

func BoolCompletion(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective)

func EnvName added in v0.6.0

func EnvName(name string) string

func WithContext added in v0.4.0

func WithContext(ctx context.Context, conf *Config) context.Context

Types

type Config

type Config struct {
	Values Values

	Inplace    bool
	Prefix     string
	LeftDelim  string
	RightDelim string
	Indent     int
	Strip      bool

	IgnoreUnsetErrors    bool
	IgnoreTemplateErrors bool

	LogLevel  string
	LogFormat string

	Completion string
	// contains filtered or unexported fields
}

func FromContext added in v0.4.0

func FromContext(ctx context.Context) (*Config, bool)

func New

func New() *Config

func (*Config) Load added in v0.6.0

func (c *Config) Load(cmd *cobra.Command) error

func (*Config) RegisterCompletions added in v0.6.0

func (c *Config) RegisterCompletions(cmd *cobra.Command)

func (*Config) RegisterFlags added in v0.6.0

func (c *Config) RegisterFlags(cmd *cobra.Command)

type Values

type Values map[string]any

func (Values) Fill

func (values Values) Fill(rawValues map[string]string)

func (Values) SetNested

func (values Values) SetNested(v any, k ...string)

func (Values) V

func (values Values) V() any

func (Values) Val

func (values Values) Val() any

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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