options

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2024 License: Apache-2.0 Imports: 5 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompleteOptions

func CompleteOptions(opt Options) error

func FindOptions

func FindOptions[T any](s OptionSetProvider) []T

Types

type Condition

type Condition interface {
	IsTrue() bool
}

func And

func And(conditions ...Condition) Condition

func Or

func Or(conditions ...Condition) Condition

type ConditionFunction

type ConditionFunction func() bool

func (ConditionFunction) IsTrue

func (f ConditionFunction) IsTrue() bool

type Flag

type Flag bool

func (Flag) IsTrue

func (f Flag) IsTrue() bool

type OptionSelector

type OptionSelector func(provider OptionSetProvider) bool

func Always

func Always() OptionSelector

func Never

func Never() OptionSelector

func Not

type OptionSet

type OptionSet []Options

func (OptionSet) AddFlags

func (s OptionSet) AddFlags(fs *pflag.FlagSet)

func (OptionSet) AsOptionSet

func (s OptionSet) AsOptionSet() OptionSet

func (OptionSet) Get

func (s OptionSet) Get(proto interface{}) bool

Get extracts the option for a given target. This might be a

  • pointer to a struct implementing the Options interface which will fill the struct with a copy of the options OR
  • a pointer to such a pointer which will be filled with the pointer to the actual member of the OptionSet.

func (OptionSet) Options

func (s OptionSet) Options(proto Options) interface{}

func (OptionSet) ProcessOnOptions

func (s OptionSet) ProcessOnOptions(f OptionsProcessor) error

ProcessOnOptions processes all options found in the option set woth a given OptionsProcessor.

func (OptionSet) Usage

func (s OptionSet) Usage() string

type OptionSetProvider

type OptionSetProvider interface {
	AsOptionSet() OptionSet
}

type OptionWithCLIContextCompleter

type OptionWithCLIContextCompleter interface {
	Configure(ctx clictx.Context) error
}

OptionWithCLIContextCompleter describes the interface for an option object requirung completion with a CLI context.

type OptionWithOutputContextCompleter

type OptionWithOutputContextCompleter interface {
	Complete(ctx out.Context) error
}

OptionWithOutputContextCompleter describes the interface for an option object requirung completion with an output context.

type Options

type Options interface {
	AddFlags(fs *pflag.FlagSet)
}

type OptionsProcessor

type OptionsProcessor func(Options) error

OptionsProcessor is handler used to process all option found in a set of options.

func CompleteOptionsWithCLIContext

func CompleteOptionsWithCLIContext(ctx clictx.Context) OptionsProcessor

type SimpleOptionCompleter

type SimpleOptionCompleter interface {
	Complete() error
}

SimpleOptionCompleter describes the interface for an option object requirung completion without any further information.

type Usage

type Usage interface {
	Usage() string
}

Jump to

Keyboard shortcuts

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