flags

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const ValuesTemplateFlag = "values-template"

ValuesTemplateFlag flag name for the values template file.

Variables

This section is empty.

Functions

func SetValuesTmplFlag

func SetValuesTmplFlag(p *pflag.FlagSet, v *string)

SetValuesTmplFlag sets up the values-template flag to the informed pointer.

Types

type DurationValue

type DurationValue struct {
	// contains filtered or unexported fields
}

DurationValue represents time.Duration as a persistent flag.

func NewDurationValue

func NewDurationValue(duration *time.Duration) *DurationValue

NewDurationValue creates a new instance with the shared time.Duration pointer.

func (*DurationValue) Set

func (d *DurationValue) Set(value string) error

Set sets the informed duration value (string) as a typed "time.Duration" equivalent, stored as a value on the shared pointer.

func (*DurationValue) String

func (d *DurationValue) String() string

String shows the current duration value.

func (*DurationValue) Type

func (*DurationValue) Type() string

Type shows the persistent flag type.

type Flags

type Flags struct {
	Debug          bool          // debug mode
	DryRun         bool          // dry-run mode
	KubeConfigPath string        // path to the kubeconfig file
	LogLevel       *slog.Level   // log verbosity level
	Timeout        time.Duration // helm client timeout
}

Flags represents the global flags for the application.

func NewFlags

func NewFlags() *Flags

NewFlags instantiates the global flags with default values.

func (*Flags) GetLogger

func (f *Flags) GetLogger(out io.Writer) *slog.Logger

GetLogger returns a logger instance for flag setting.

func (*Flags) LoggerWith

func (f *Flags) LoggerWith(l *slog.Logger) *slog.Logger

LoggerWith returns a logger with contextual information.

func (*Flags) PersistentFlags

func (f *Flags) PersistentFlags(p *pflag.FlagSet)

PersistentFlags sets up the global flags.

type LogLevelValue

type LogLevelValue struct {
	// contains filtered or unexported fields
}

LogLevelValue represents slog.Level as a persistent flag.

func NewLogLevelValue

func NewLogLevelValue(logLevel *slog.Level) *LogLevelValue

NewLogLevelValue creates a new instance with the shared slog.Level pointer.

func (*LogLevelValue) Set

func (l *LogLevelValue) Set(level string) error

Set sets the informed level name (string) as a typed "slog.Level" equivalent, stored as a valued on the shared pointer.

func (*LogLevelValue) String

func (l *LogLevelValue) String() string

String shows the current level name.

func (*LogLevelValue) Type

func (*LogLevelValue) Type() string

Type shows the persistent flag type.

Jump to

Keyboard shortcuts

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