flag

package
v0.0.0-...-9cf7c1c Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	FeatureFlagName        = "feature"
	ExcludeFeatureFlagName = "exclude"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type IncludeExcludeStringSet

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

IncludeExcludeStringSet allows unsetting strings seen in a StringSet.

func NewFeatureFlag

func NewFeatureFlag(features []string) *IncludeExcludeStringSet

NewFeatureFlag defines two flags, FeatureFlagName and ExcludeFeatureFlagName, to allow setting and excluding certain features.

func NewIncludeExcludeStringSet

func NewIncludeExcludeStringSet(include *StringSet, name, usage string, all []string) *IncludeExcludeStringSet

NewIncludeExcludeStringSet returns a new NewIncludeExcludeStringSet.

func (*IncludeExcludeStringSet) IsSet

func (es *IncludeExcludeStringSet) IsSet(s string) bool

func (*IncludeExcludeStringSet) Len

func (es *IncludeExcludeStringSet) Len() int

func (*IncludeExcludeStringSet) Set

func (*IncludeExcludeStringSet) String

func (es *IncludeExcludeStringSet) String() string

func (*IncludeExcludeStringSet) Strings

func (es *IncludeExcludeStringSet) Strings() []string

type LogrusLevel

type LogrusLevel struct {
	Level logrus.Level
}

LogrusLevel is a flag that accepts logrus logging levels as strings.

func NewLogrusLevel

func NewLogrusLevel(name, value, usage string) *LogrusLevel

func (*LogrusLevel) Set

func (l *LogrusLevel) Set(s string) error

func (*LogrusLevel) String

func (l *LogrusLevel) String() string

type StringSet

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

StringSet is a type to be used with the standard library's flag.Var function as a custom flag value, similar to "github.com/urfave/cli".StringSet, but it only tracks unique instances.

It takes either a comma-separated list of strings, or repeated invocations.

func NewStringSet

func NewStringSet(name, usage string, caseSensitive bool) *StringSet

NewStringSet returns a new StringSetFlag with an empty set.

func (*StringSet) IsSet

func (ss *StringSet) IsSet(s string) bool

func (*StringSet) Len

func (ss *StringSet) Len() int

func (*StringSet) Set

func (ss *StringSet) Set(s string) error

Set is called by `flag` each time the flag is seen when parsing the command line.

func (*StringSet) String

func (ss *StringSet) String() string

func (*StringSet) Strings

func (ss *StringSet) Strings() []string

Strings returns a string slice of the flags provided to the flag.

Jump to

Keyboard shortcuts

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