config

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2024 License: Apache-2.0 Imports: 15 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"
	VarFlag        = "var"
	ValueFlag      = "value"
	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 CurrentValueKey = "Value"

CurrentValueKey is the key for the current YAML node's value

deprecated

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 {
	Vars Vars

	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 DeprecatedWriter added in v0.6.1

type DeprecatedWriter struct{}

func (DeprecatedWriter) Write added in v0.6.1

func (d DeprecatedWriter) Write(b []byte) (int, error)

type Vars added in v0.6.1

type Vars map[string]any

func (Vars) Fill added in v0.6.1

func (vars Vars) Fill(src map[string]string)

func (Vars) SetNested added in v0.6.1

func (vars Vars) SetNested(v any, k ...string)

func (Vars) V deprecated added in v0.6.1

func (vars Vars) V() any

V returns the current YAML node value

Deprecated: Use `current` template function instead

func (Vars) Val deprecated added in v0.6.1

func (vars Vars) Val() any

Val returns the current YAML node value

Deprecated: Use `current` template function instead

func (Vars) Value deprecated added in v0.6.1

func (vars Vars) Value() any

Value returns the current YAML node value

Deprecated: Use `current` template function instead

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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