package flag

import "github.com/Microsoft/hcsshim/test/pkg/flag"

Index

Constants

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

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.

Source Files

flag.go

Version
v0.0.0-20250605171046-9b2e94f54499 (latest)
Published
Jun 5, 2025
Platform
linux/amd64
Imports
4 packages
Last checked
1 hour ago

Tools for package owners.