flag

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2020 License: GPL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DateTimeFormat describes a short format supported by the flag
	DateTimeFormat = "2006.01.02-15:04"
	// DateTimeFormatTz describes long format supported by the flag
	DateTimeFormatTz = "2006.01.02-15:04:05-MST"

	// DateTimeExampleFormat is an exemplary valid datetime flag
	DateTimeExampleFormat = "2006.01.28-15:30"
	// DateTimeFormatDescr contains a description of the supported formats
	DateTimeFormatDescr = "YYYY.MM.DD-HH:MM[:SS-TZ]"
)
View Source
const BuildStatusFormatDescription string = "one of " +
	buildStatusExist + ", " +
	buildStatusPending + ", " +
	buildStatusInputUndefined + ", " +
	buildStatusBuildCommandUndefined

BuildStatusFormatDescription is the format description for the flag

View Source
const FieldSep = ","

FieldSep specifies the separator when passing multiple values to the flag

Variables

This section is empty.

Functions

This section is empty.

Types

type BuildStatus

type BuildStatus struct {
	Status baur.BuildStatus
	// contains filtered or unexported fields
}

BuildStatus is a commandline parameter to specify build status filters

func (*BuildStatus) IsSet

func (b *BuildStatus) IsSet() bool

IsSet returns true if the flag parsed a commandline value (Set() was called)

func (*BuildStatus) Set

func (b *BuildStatus) Set(val string) error

Set parses the passed string and sets the SortFlagValue

func (*BuildStatus) String

func (b *BuildStatus) String() string

String returns the default value in the usage output

func (*BuildStatus) Type

func (b *BuildStatus) Type() string

Type returns the format description of the flag

func (*BuildStatus) Usage

func (b *BuildStatus) Usage(highlightFn func(a ...interface{}) string) string

Usage returns a usage description, important parts are passed through highlightFn

type DateTimeFlagValue

type DateTimeFlagValue struct {
	time.Time
}

DateTimeFlagValue is the DateTime pflag flag

func (*DateTimeFlagValue) Set

func (v *DateTimeFlagValue) Set(timeStr string) error

Set implements the pflag.Value interface

func (*DateTimeFlagValue) String

func (v *DateTimeFlagValue) String() string

String returns the default value in the usage output

func (*DateTimeFlagValue) Type

func (*DateTimeFlagValue) Type() string

Type returns the value description string

type Fields

type Fields struct {
	Fields []string
	// contains filtered or unexported fields
}

Fields is a commandline flag that allows to enable one or more boolean fields by passing them in a format like "-f id,duration,path". The passed values are case-insensitive.

func NewFields

func NewFields(fields []string) *Fields

NewFields returns a new flag that supports the passed fields.

func (*Fields) Set

func (f *Fields) Set(val string) error

Set parses a list of fields, fields contained in the string are set to true, all others are set to fault. If an unrecognized option value is passed a error is returned

func (*Fields) String

func (f *Fields) String() string

String returns the default value in the usage output

func (*Fields) Type

func (f *Fields) Type() string

Type returns the format description

func (*Fields) Usage

func (f *Fields) Usage(highlightFn func(a ...interface{}) string) string

Usage returns a usage description, important parts are passed through highlightFn

func (*Fields) ValidValues

func (f *Fields) ValidValues() string

ValidValues returns the values that the flag accepts

type Sort

type Sort struct {
	Value storage.Sorter
	// contains filtered or unexported fields
}

Sort is a commandline flag to specify via which field and in which order output should be sorted

func NewSort

func NewSort(validFields map[string]storage.Field) *Sort

NewSort returns a Sort flag. The keys in the validFields maps are accepted as value for Fields and map to the storage.Field values.

func (*Sort) Set

func (s *Sort) Set(sortStr string) error

Set parses the passed string and sets the Sort

func (*Sort) String

func (s *Sort) String() string

String returns the default value in the usage output

func (*Sort) Type

func (s *Sort) Type() string

Type returns the format description

func (*Sort) Usage

func (s *Sort) Usage(highlightFn func(a ...interface{}) string) string

Usage returns a usage description, important parts are passed through highlightFn

Jump to

Keyboard shortcuts

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