flags

package
v1.1.6-rc1 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	EnginesFlag        = ArrayValueFlagFrom(EngineFlag)
	PublishersFlag     = ArrayValueFlagFrom(PublisherFlag)
	StorageSourcesFlag = ArrayValueFlagFrom(StorageSourceFlag)
)

Functions

func ArrayValueFlagFrom

func ArrayValueFlagFrom[T any](singleFlag func(*T) *ValueFlag[T]) func(*[]T) *ArrayValueFlag[T]

Converts a value flag into a flag that can accept multiple of the same value.

func DisabledFeatureCLIFlags

func DisabledFeatureCLIFlags(config *node.FeatureConfig) *pflag.FlagSet

func JobSelectionCLIFlags

func JobSelectionCLIFlags(policy *node.JobSelectionPolicy) *pflag.FlagSet

Types

type ArrayValueFlag

type ArrayValueFlag[T any] struct {
	// contains filtered or unexported fields
}

An ArrayValueFlag is like a ValueFlag except it will add the command line value into a slice of values, and hence can be used for flags that are meant to appear multiple times.

func ExcludedTagFlag

func ExcludedTagFlag(value *[]model.ExcludedTag) *ArrayValueFlag[model.ExcludedTag]

func IncludedTagFlag

func IncludedTagFlag(value *[]model.IncludedTag) *ArrayValueFlag[model.IncludedTag]

func NewIPFSStorageSpecArrayFlag

func NewIPFSStorageSpecArrayFlag(value *[]model.StorageSpec) *ArrayValueFlag[model.StorageSpec]

func NewURLStorageSpecArrayFlag

func NewURLStorageSpecArrayFlag(value *[]model.StorageSpec) *ArrayValueFlag[model.StorageSpec]

func (*ArrayValueFlag[T]) Set

func (s *ArrayValueFlag[T]) Set(input string) error

Set implements pflag.Value

func (*ArrayValueFlag[T]) String

func (s *ArrayValueFlag[T]) String() string

String implements pflag.Value

func (*ArrayValueFlag[T]) Type

func (s *ArrayValueFlag[T]) Type() string

Type implements pflag.Value

type KeyValueParser

type KeyValueParser[K comparable, V any] func(string) (K, V, error)

A KeyValueParser is like a Parser except that it returns two values representing a key and a value.

type KeyValueStringer

type KeyValueStringer[K comparable, V any] func(*K, *V) string

A KeyValueStringer is like a Stringer except that it converts native objects representing a key and a value into a string.

type MapValueFlag

type MapValueFlag[K comparable, V any] struct {
	// contains filtered or unexported fields
}

A MapValueFlag is like a ValueFlag except it will add the command line value into a map of values, and hence can be used for flags that are meant to appear multiple times and represent a key-value structure.

func (*MapValueFlag[K, V]) Set

func (s *MapValueFlag[K, V]) Set(input string) error

Set implements pflag.Value

func (*MapValueFlag[K, V]) String

func (s *MapValueFlag[K, V]) String() string

String implements pflag.Value

func (*MapValueFlag[K, V]) Type

func (s *MapValueFlag[K, V]) Type() string

Type implements pflag.Value

type Parser

type Parser[T any] func(string) (T, error)

A Parser is a function that can convert a string into a native object.

type Stringer

type Stringer[T any] func(*T) string

A Stringer is a function that can convert a native object into a string.

type ValueFlag

type ValueFlag[T any] struct {
	// contains filtered or unexported fields
}

A ValueFlag is a pflag.Value that knows how to take a command line value represented as a string and set it as a native object into a struct.

func EngineFlag

func EngineFlag(value *string) *ValueFlag[string]

func LoggingFlag

func LoggingFlag(value *logger.LogMode) *ValueFlag[logger.LogMode]

func NetworkFlag

func NetworkFlag(value *model.Network) *ValueFlag[model.Network]

func OutputFormatFlag

func OutputFormatFlag(value *output.OutputFormat) *ValueFlag[output.OutputFormat]

func PublisherFlag

func PublisherFlag(value *string) *ValueFlag[string]

func StorageSourceFlag

func StorageSourceFlag(value *string) *ValueFlag[string]

func StorageTypeFlag

func StorageTypeFlag(value *types.StorageType) *ValueFlag[types.StorageType]

func TargetingFlag

func TargetingFlag(value *model.TargetingMode) *ValueFlag[model.TargetingMode]

func URLFlag

func URLFlag(value **url.URL, schemes ...string) *ValueFlag[*url.URL]

func (*ValueFlag[T]) Set

func (s *ValueFlag[T]) Set(input string) error

Set implements pflag.Value

func (*ValueFlag[T]) String

func (s *ValueFlag[T]) String() string

String implements pflag.Value

func (*ValueFlag[T]) Type

func (s *ValueFlag[T]) Type() string

Type implements pflag.Value

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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