Documentation
¶
Index ¶
- func WithChoices[T interface{ ... }](opt T, choices ...string) T
- func WithCompleter[T interface{ ... }](opt T, completer Completer) T
- func WithDefault[T interface{ ... }](opt T, value string) T
- func WithHidden[T interface{ ... }](opt T) T
- func WithIdCompleter[T interface{ ... }](opt T, completer Completer) T
- func WithMetavar[T interface{ ... }](opt T, metavar string) T
- func WithNargs[T interface{ ... }](opt T, nargs Nargs) T
- func WithOptionalArgument[T interface{ ... }](opt T, constValue string) T
- type BoolOption
- func (base *BoolOption) GetChoices() []string
- func (base *BoolOption) GetCompleter() Completer
- func (base *BoolOption) GetCompletesIds() bool
- func (base *BoolOption) GetConst() string
- func (base *BoolOption) GetDefault() *string
- func (base *BoolOption) GetHidden() bool
- func (base *BoolOption) GetLongName() string
- func (base *BoolOption) GetMetavar() string
- func (base *BoolOption) GetNargs() Nargs
- func (base *BoolOption) GetRequired() bool
- func (base *BoolOption) GetShortName() string
- func (base *BoolOption) GetUsage() string
- func (boolOption *BoolOption) Set(_ string) error
- func (base *BoolOption) SetChoices(choices ...string)
- func (base *BoolOption) SetCompleter(completer Completer, ids bool)
- func (base *BoolOption) SetConst(value string)
- func (base *BoolOption) SetDefault(value string)
- func (base *BoolOption) SetHidden(hidden bool)
- func (*BoolOption) SetIsPure()
- func (base *BoolOption) SetMetavar(metavar string)
- func (base *BoolOption) SetNargs(nargs Nargs)
- type Candidate
- type ChoiceNormalizer
- type ChoicesProvider
- type Completer
- type CompleterProvider
- type ConstProvider
- type CountedOption
- func (base *CountedOption) GetChoices() []string
- func (base *CountedOption) GetCompleter() Completer
- func (base *CountedOption) GetCompletesIds() bool
- func (base *CountedOption) GetConst() string
- func (base *CountedOption) GetDefault() *string
- func (base *CountedOption) GetHidden() bool
- func (base *CountedOption) GetLongName() string
- func (base *CountedOption) GetMetavar() string
- func (base *CountedOption) GetNargs() Nargs
- func (base *CountedOption) GetRequired() bool
- func (base *CountedOption) GetShortName() string
- func (base *CountedOption) GetUsage() string
- func (countedOption *CountedOption) Set(_ string) error
- func (base *CountedOption) SetChoices(choices ...string)
- func (base *CountedOption) SetCompleter(completer Completer, ids bool)
- func (base *CountedOption) SetConst(value string)
- func (base *CountedOption) SetDefault(value string)
- func (base *CountedOption) SetHidden(hidden bool)
- func (*CountedOption) SetIsPure()
- func (base *CountedOption) SetMetavar(metavar string)
- func (base *CountedOption) SetNargs(nargs Nargs)
- type DefaultProvider
- type FileOption
- func (base *FileOption) GetChoices() []string
- func (base *FileOption) GetCompleter() Completer
- func (base *FileOption) GetCompletesIds() bool
- func (base *FileOption) GetConst() string
- func (base *FileOption) GetDefault() *string
- func (base *FileOption) GetHidden() bool
- func (base *FileOption) GetLongName() string
- func (base *FileOption) GetMetavar() string
- func (base *FileOption) GetNargs() Nargs
- func (base *FileOption) GetRequired() bool
- func (base *FileOption) GetShortName() string
- func (base *FileOption) GetUsage() string
- func (fileOption *FileOption) Set(in string) error
- func (base *FileOption) SetChoices(choices ...string)
- func (base *FileOption) SetCompleter(completer Completer, ids bool)
- func (base *FileOption) SetConst(value string)
- func (base *FileOption) SetDefault(value string)
- func (base *FileOption) SetHidden(hidden bool)
- func (base *FileOption) SetMetavar(metavar string)
- func (base *FileOption) SetNargs(nargs Nargs)
- type HiddenProvider
- type IntOption
- func (base *IntOption) GetChoices() []string
- func (base *IntOption) GetCompleter() Completer
- func (base *IntOption) GetCompletesIds() bool
- func (base *IntOption) GetConst() string
- func (base *IntOption) GetDefault() *string
- func (base *IntOption) GetHidden() bool
- func (base *IntOption) GetLongName() string
- func (base *IntOption) GetMetavar() string
- func (base *IntOption) GetNargs() Nargs
- func (base *IntOption) GetRequired() bool
- func (base *IntOption) GetShortName() string
- func (base *IntOption) GetUsage() string
- func (intOption *IntOption) NormalizeChoice(in string) (string, error)
- func (intOption *IntOption) Set(in string) error
- func (base *IntOption) SetChoices(choices ...string)
- func (base *IntOption) SetCompleter(completer Completer, ids bool)
- func (base *IntOption) SetConst(value string)
- func (base *IntOption) SetDefault(value string)
- func (base *IntOption) SetHidden(hidden bool)
- func (*IntOption) SetIsPure()
- func (base *IntOption) SetMetavar(metavar string)
- func (base *IntOption) SetNargs(nargs Nargs)
- type IntsOption
- func (base *IntsOption) GetChoices() []string
- func (base *IntsOption) GetCompleter() Completer
- func (base *IntsOption) GetCompletesIds() bool
- func (base *IntsOption) GetConst() string
- func (base *IntsOption) GetDefault() *string
- func (base *IntsOption) GetHidden() bool
- func (base *IntsOption) GetLongName() string
- func (base *IntsOption) GetMetavar() string
- func (base *IntsOption) GetNargs() Nargs
- func (base *IntsOption) GetRequired() bool
- func (base *IntsOption) GetShortName() string
- func (base *IntsOption) GetUsage() string
- func (intsOption *IntsOption) NormalizeChoice(in string) (string, error)
- func (intsOption *IntsOption) Set(in string) error
- func (base *IntsOption) SetChoices(choices ...string)
- func (base *IntsOption) SetCompleter(completer Completer, ids bool)
- func (base *IntsOption) SetConst(value string)
- func (base *IntsOption) SetDefault(value string)
- func (base *IntsOption) SetHidden(hidden bool)
- func (*IntsOption) SetIsPure()
- func (base *IntsOption) SetMetavar(metavar string)
- func (base *IntsOption) SetNargs(nargs Nargs)
- type Nargs
- type Option
- type PureSetter
- type StringOption
- func (base *StringOption) GetChoices() []string
- func (base *StringOption) GetCompleter() Completer
- func (base *StringOption) GetCompletesIds() bool
- func (base *StringOption) GetConst() string
- func (base *StringOption) GetDefault() *string
- func (base *StringOption) GetHidden() bool
- func (base *StringOption) GetLongName() string
- func (base *StringOption) GetMetavar() string
- func (base *StringOption) GetNargs() Nargs
- func (base *StringOption) GetRequired() bool
- func (base *StringOption) GetShortName() string
- func (base *StringOption) GetUsage() string
- func (stringOption *StringOption) Set(in string) error
- func (base *StringOption) SetChoices(choices ...string)
- func (base *StringOption) SetCompleter(completer Completer, ids bool)
- func (base *StringOption) SetConst(value string)
- func (base *StringOption) SetDefault(value string)
- func (base *StringOption) SetHidden(hidden bool)
- func (*StringOption) SetIsPure()
- func (base *StringOption) SetMetavar(metavar string)
- func (base *StringOption) SetNargs(nargs Nargs)
- type StringsOption
- func (base *StringsOption) GetChoices() []string
- func (base *StringsOption) GetCompleter() Completer
- func (base *StringsOption) GetCompletesIds() bool
- func (base *StringsOption) GetConst() string
- func (base *StringsOption) GetDefault() *string
- func (base *StringsOption) GetHidden() bool
- func (base *StringsOption) GetLongName() string
- func (base *StringsOption) GetMetavar() string
- func (base *StringsOption) GetNargs() Nargs
- func (base *StringsOption) GetRequired() bool
- func (base *StringsOption) GetShortName() string
- func (base *StringsOption) GetUsage() string
- func (stringsOption *StringsOption) Set(in string) error
- func (base *StringsOption) SetChoices(choices ...string)
- func (base *StringsOption) SetCompleter(completer Completer, ids bool)
- func (base *StringsOption) SetConst(value string)
- func (base *StringsOption) SetDefault(value string)
- func (base *StringsOption) SetHidden(hidden bool)
- func (*StringsOption) SetIsPure()
- func (base *StringsOption) SetMetavar(metavar string)
- func (base *StringsOption) SetNargs(nargs Nargs)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithChoices ¶
WithChoices restricts an option to the given values and returns it, so that it may be declared inside an option list.
func WithCompleter ¶ added in v1.122.0
func WithCompleter[T interface {
Option
SetCompleter(Completer, bool)
}](opt T, completer Completer) T
WithCompleter has an option offer its values from completer when a shell asks, and returns it. Choices, where an option has them, are offered instead.
func WithDefault ¶
WithDefault gives an option the value it takes when no argument names it, and returns it.
func WithHidden ¶ added in v1.42.0
WithHidden keeps an option out of the help and out of a generated completion, and returns it.
It is for options that exist for a person to run once rather than to reach for: writing a completion script, printing a version. They would otherwise sit in the help of every invocation to serve a thing done at installation.
The option is accepted exactly as any other. Hidden means unlisted, not unavailable, and it is not a way to keep something secret: anything that must not be used should not be declared.
func WithIdCompleter ¶ added in v1.122.0
func WithIdCompleter[T interface {
Option
SetCompleter(Completer, bool)
}](opt T, completer Completer) T
WithIdCompleter is WithCompleter for values that are identifiers, such as a database's keys: a shell shows each by its description, which says what it is, and inserts the identifier.
func WithMetavar ¶
WithMetavar names an option's argument in the help message, and returns it. A positional is named this way: its metavar is what the help calls it, having no option name to go by.
Types ¶
type BoolOption ¶
type BoolOption struct {
Value *bool
// contains filtered or unexported fields
}
BoolOption takes no argument and records that the option was present.
func NewBoolOption ¶
func (*BoolOption) GetChoices ¶
func (base *BoolOption) GetChoices() []string
func (*BoolOption) GetCompleter ¶ added in v1.122.0
func (base *BoolOption) GetCompleter() Completer
func (*BoolOption) GetCompletesIds ¶ added in v1.122.0
func (base *BoolOption) GetCompletesIds() bool
func (*BoolOption) GetDefault ¶
func (base *BoolOption) GetDefault() *string
func (*BoolOption) GetHidden ¶ added in v1.42.0
func (base *BoolOption) GetHidden() bool
GetHidden reports whether the option is kept out of what is shown to a person.
func (*BoolOption) GetLongName ¶
func (base *BoolOption) GetLongName() string
func (*BoolOption) GetMetavar ¶
func (base *BoolOption) GetMetavar() string
func (*BoolOption) GetRequired ¶
func (base *BoolOption) GetRequired() bool
func (*BoolOption) GetShortName ¶
func (base *BoolOption) GetShortName() string
GetShortName returns the option's short name, or the empty string when it has none. A zero ShortName must not render as "\x00": that is a name like any other, and every option lacking a short name would collide on it.
func (*BoolOption) Set ¶
func (boolOption *BoolOption) Set(_ string) error
func (*BoolOption) SetChoices ¶
func (base *BoolOption) SetChoices(choices ...string)
func (*BoolOption) SetCompleter ¶ added in v1.122.0
func (*BoolOption) SetDefault ¶
func (base *BoolOption) SetDefault(value string)
func (*BoolOption) SetIsPure ¶ added in v1.122.0
func (*BoolOption) SetIsPure()
SetIsPure marks Set as recording the value and nothing more.
func (*BoolOption) SetMetavar ¶
func (base *BoolOption) SetMetavar(metavar string)
type Candidate ¶ added in v1.122.0
type Candidate struct {
// Value is the argument itself, what completing it inserts.
Value string
// Description says what the value is, one line, shown beside it.
Description string
}
Candidate is a value an option or positional could be given, offered when a shell asks for the completions of a command line.
type ChoiceNormalizer ¶
ChoiceNormalizer is implemented by options whose values have more than one spelling, so that choices may be compared in a single form. An option that does not implement it has its choices compared against the argument as written.
type ChoicesProvider ¶
type ChoicesProvider interface {
GetChoices() []string
}
ChoicesProvider is implemented by options that accept only certain values. Every option built by this package implements it; a hand-written Option may.
type Completer ¶ added in v1.122.0
Completer offers the values an option or positional could be given, for the values no list fixed in the declaration can hold: names of things the program reaches at run time. prefix is what was typed of the value so far; the completer filters by it, as it sees fit, and returns its candidates in the order to show them. It is called only when a shell asks for completions, after the options given earlier on the command line have been set, so it may read them.
type CompleterProvider ¶ added in v1.122.0
type CompleterProvider interface {
GetCompleter() Completer
// GetCompletesIds reports whether the completer's values are identifiers that mean nothing to a
// person, which a shell should show by their descriptions while inserting the values.
GetCompletesIds() bool
}
CompleterProvider is implemented by options that can offer their values at run time. Every option built by this package implements it; a hand-written Option may.
type ConstProvider ¶
type ConstProvider interface {
GetConst() string
}
ConstProvider is implemented by NargsOptional options, supplying the value to use when the option is given without an argument.
type CountedOption ¶
type CountedOption struct {
Count *int
// contains filtered or unexported fields
}
CountedOption takes no argument and counts how many times the option was given.
func NewCountedOption ¶
func (*CountedOption) GetChoices ¶
func (base *CountedOption) GetChoices() []string
func (*CountedOption) GetCompleter ¶ added in v1.122.0
func (base *CountedOption) GetCompleter() Completer
func (*CountedOption) GetCompletesIds ¶ added in v1.122.0
func (base *CountedOption) GetCompletesIds() bool
func (*CountedOption) GetDefault ¶
func (base *CountedOption) GetDefault() *string
func (*CountedOption) GetHidden ¶ added in v1.42.0
func (base *CountedOption) GetHidden() bool
GetHidden reports whether the option is kept out of what is shown to a person.
func (*CountedOption) GetLongName ¶
func (base *CountedOption) GetLongName() string
func (*CountedOption) GetMetavar ¶
func (base *CountedOption) GetMetavar() string
func (*CountedOption) GetRequired ¶
func (base *CountedOption) GetRequired() bool
func (*CountedOption) GetShortName ¶
func (base *CountedOption) GetShortName() string
GetShortName returns the option's short name, or the empty string when it has none. A zero ShortName must not render as "\x00": that is a name like any other, and every option lacking a short name would collide on it.
func (*CountedOption) Set ¶
func (countedOption *CountedOption) Set(_ string) error
func (*CountedOption) SetChoices ¶
func (base *CountedOption) SetChoices(choices ...string)
func (*CountedOption) SetCompleter ¶ added in v1.122.0
func (*CountedOption) SetDefault ¶
func (base *CountedOption) SetDefault(value string)
func (*CountedOption) SetHidden ¶ added in v1.42.0
func (base *CountedOption) SetHidden(hidden bool)
func (*CountedOption) SetIsPure ¶ added in v1.122.0
func (*CountedOption) SetIsPure()
SetIsPure marks Set as recording the value and nothing more.
func (*CountedOption) SetMetavar ¶
func (base *CountedOption) SetMetavar(metavar string)
type DefaultProvider ¶
type DefaultProvider interface {
GetDefault() *string
}
DefaultProvider is implemented by options that are set to a value when no argument names them. The value is nil when no default was declared, which is what distinguishes having no default from defaulting to the empty string.
type FileOption ¶
type FileOption struct {
File *os.File
Flag int
Mode os.FileMode
// contains filtered or unexported fields
}
FileOption opens the path it is given with Flag and Mode, as os.OpenFile does.
func NewFileOption ¶
func NewFileOption(shortName rune, longName string, usage string, required bool, file *os.File) *FileOption
NewFileOption returns a FileOption that opens the path for reading. Use NewFileOptionExtra to choose the flag and mode.
func NewFileOptionExtra ¶
func (*FileOption) GetChoices ¶
func (base *FileOption) GetChoices() []string
func (*FileOption) GetCompleter ¶ added in v1.122.0
func (base *FileOption) GetCompleter() Completer
func (*FileOption) GetCompletesIds ¶ added in v1.122.0
func (base *FileOption) GetCompletesIds() bool
func (*FileOption) GetDefault ¶
func (base *FileOption) GetDefault() *string
func (*FileOption) GetHidden ¶ added in v1.42.0
func (base *FileOption) GetHidden() bool
GetHidden reports whether the option is kept out of what is shown to a person.
func (*FileOption) GetLongName ¶
func (base *FileOption) GetLongName() string
func (*FileOption) GetMetavar ¶
func (base *FileOption) GetMetavar() string
func (*FileOption) GetRequired ¶
func (base *FileOption) GetRequired() bool
func (*FileOption) GetShortName ¶
func (base *FileOption) GetShortName() string
GetShortName returns the option's short name, or the empty string when it has none. A zero ShortName must not render as "\x00": that is a name like any other, and every option lacking a short name would collide on it.
func (*FileOption) Set ¶
func (fileOption *FileOption) Set(in string) error
func (*FileOption) SetChoices ¶
func (base *FileOption) SetChoices(choices ...string)
func (*FileOption) SetCompleter ¶ added in v1.122.0
func (*FileOption) SetDefault ¶
func (base *FileOption) SetDefault(value string)
func (*FileOption) SetMetavar ¶
func (base *FileOption) SetMetavar(metavar string)
type HiddenProvider ¶ added in v1.42.0
type HiddenProvider interface {
GetHidden() bool
}
HiddenProvider is implemented by options that are accepted but not shown. Every option built by this package implements it; a hand-written Option may.
type IntOption ¶
type IntOption struct {
Value *int
// contains filtered or unexported fields
}
IntOption stores the argument it is given as an int, replacing any previous value.
func NewIntOption ¶
func (*IntOption) GetChoices ¶
func (base *IntOption) GetChoices() []string
func (*IntOption) GetCompleter ¶ added in v1.122.0
func (base *IntOption) GetCompleter() Completer
func (*IntOption) GetCompletesIds ¶ added in v1.122.0
func (base *IntOption) GetCompletesIds() bool
func (*IntOption) GetDefault ¶
func (base *IntOption) GetDefault() *string
func (*IntOption) GetHidden ¶ added in v1.42.0
func (base *IntOption) GetHidden() bool
GetHidden reports whether the option is kept out of what is shown to a person.
func (*IntOption) GetLongName ¶
func (base *IntOption) GetLongName() string
func (*IntOption) GetMetavar ¶
func (base *IntOption) GetMetavar() string
func (*IntOption) GetRequired ¶
func (base *IntOption) GetRequired() bool
func (*IntOption) GetShortName ¶
func (base *IntOption) GetShortName() string
GetShortName returns the option's short name, or the empty string when it has none. A zero ShortName must not render as "\x00": that is a name like any other, and every option lacking a short name would collide on it.
func (*IntOption) NormalizeChoice ¶
NormalizeChoice renders an int the one way, so that a choice of "7" also admits "007" and "+7".
func (*IntOption) SetChoices ¶
func (base *IntOption) SetChoices(choices ...string)
func (*IntOption) SetCompleter ¶ added in v1.122.0
func (*IntOption) SetDefault ¶
func (base *IntOption) SetDefault(value string)
func (*IntOption) SetIsPure ¶ added in v1.122.0
func (*IntOption) SetIsPure()
SetIsPure marks Set as recording the value and nothing more.
func (*IntOption) SetMetavar ¶
func (base *IntOption) SetMetavar(metavar string)
type IntsOption ¶
type IntsOption struct {
Value *[]int
// contains filtered or unexported fields
}
IntsOption appends each argument it is given to a slice of ints.
func NewIntsOption ¶
func (*IntsOption) GetChoices ¶
func (base *IntsOption) GetChoices() []string
func (*IntsOption) GetCompleter ¶ added in v1.122.0
func (base *IntsOption) GetCompleter() Completer
func (*IntsOption) GetCompletesIds ¶ added in v1.122.0
func (base *IntsOption) GetCompletesIds() bool
func (*IntsOption) GetDefault ¶
func (base *IntsOption) GetDefault() *string
func (*IntsOption) GetHidden ¶ added in v1.42.0
func (base *IntsOption) GetHidden() bool
GetHidden reports whether the option is kept out of what is shown to a person.
func (*IntsOption) GetLongName ¶
func (base *IntsOption) GetLongName() string
func (*IntsOption) GetMetavar ¶
func (base *IntsOption) GetMetavar() string
func (*IntsOption) GetRequired ¶
func (base *IntsOption) GetRequired() bool
func (*IntsOption) GetShortName ¶
func (base *IntsOption) GetShortName() string
GetShortName returns the option's short name, or the empty string when it has none. A zero ShortName must not render as "\x00": that is a name like any other, and every option lacking a short name would collide on it.
func (*IntsOption) NormalizeChoice ¶
func (intsOption *IntsOption) NormalizeChoice(in string) (string, error)
NormalizeChoice renders an int the one way, so that a choice of "7" also admits "007" and "+7".
func (*IntsOption) Set ¶
func (intsOption *IntsOption) Set(in string) error
func (*IntsOption) SetChoices ¶
func (base *IntsOption) SetChoices(choices ...string)
func (*IntsOption) SetCompleter ¶ added in v1.122.0
func (*IntsOption) SetDefault ¶
func (base *IntsOption) SetDefault(value string)
func (*IntsOption) SetIsPure ¶ added in v1.122.0
func (*IntsOption) SetIsPure()
SetIsPure marks Set as recording the value and nothing more.
func (*IntsOption) SetMetavar ¶
func (base *IntsOption) SetMetavar(metavar string)
type Nargs ¶
type Nargs string
Nargs describes how many arguments an option consumes.
const ( // NargsOne marks an option that consumes exactly one argument. It is the zero value, so an // option that does not say otherwise takes one argument. NargsOne Nargs = "" // NargsNone marks an option that takes no argument, such as a flag or a counter. NargsNone Nargs = "0" // NargsOptional marks an option whose argument may be omitted. Given without one, it is set to // its constant instead. NargsOptional Nargs = "?" // NargsAtLeastOne marks an option that may be given repeatedly, accumulating its arguments, and // must be given at least once. NargsAtLeastOne Nargs = "+" // NargsAny is NargsAtLeastOne without the obligation: it accumulates, and may be left out. NargsAny Nargs = "*" )
func (Nargs) IsVariadic ¶
IsVariadic reports whether an arity accumulates its arguments rather than taking a fixed number.
type Option ¶
type Option interface {
Set(string) error
GetShortName() string
GetLongName() string
GetUsage() string
GetRequired() bool
GetNargs() Nargs
GetMetavar() string
}
Option is a single command-line option, addressable by a short name, a long name, or both.
type PureSetter ¶ added in v1.122.0
type PureSetter interface {
SetIsPure()
}
PureSetter is implemented by options whose Set only records the value, with no effect outside the program's own variables. Only such options are set while answering a request for completions, which is not a run of the program: a FileOption, which opens and may create or truncate a file, is not one.
type StringOption ¶
type StringOption struct {
Value *string
// contains filtered or unexported fields
}
StringOption stores the argument it is given, replacing any previous value.
func NewStringOption ¶
func (*StringOption) GetChoices ¶
func (base *StringOption) GetChoices() []string
func (*StringOption) GetCompleter ¶ added in v1.122.0
func (base *StringOption) GetCompleter() Completer
func (*StringOption) GetCompletesIds ¶ added in v1.122.0
func (base *StringOption) GetCompletesIds() bool
func (*StringOption) GetDefault ¶
func (base *StringOption) GetDefault() *string
func (*StringOption) GetHidden ¶ added in v1.42.0
func (base *StringOption) GetHidden() bool
GetHidden reports whether the option is kept out of what is shown to a person.
func (*StringOption) GetLongName ¶
func (base *StringOption) GetLongName() string
func (*StringOption) GetMetavar ¶
func (base *StringOption) GetMetavar() string
func (*StringOption) GetRequired ¶
func (base *StringOption) GetRequired() bool
func (*StringOption) GetShortName ¶
func (base *StringOption) GetShortName() string
GetShortName returns the option's short name, or the empty string when it has none. A zero ShortName must not render as "\x00": that is a name like any other, and every option lacking a short name would collide on it.
func (*StringOption) Set ¶
func (stringOption *StringOption) Set(in string) error
func (*StringOption) SetChoices ¶
func (base *StringOption) SetChoices(choices ...string)
func (*StringOption) SetCompleter ¶ added in v1.122.0
func (*StringOption) SetDefault ¶
func (base *StringOption) SetDefault(value string)
func (*StringOption) SetIsPure ¶ added in v1.122.0
func (*StringOption) SetIsPure()
SetIsPure marks Set as recording the value and nothing more.
func (*StringOption) SetMetavar ¶
func (base *StringOption) SetMetavar(metavar string)
type StringsOption ¶
type StringsOption struct {
Value *[]string
// contains filtered or unexported fields
}
StringsOption appends each argument it is given to a slice of strings.
func NewStringsOption ¶
func (*StringsOption) GetChoices ¶
func (base *StringsOption) GetChoices() []string
func (*StringsOption) GetCompleter ¶ added in v1.122.0
func (base *StringsOption) GetCompleter() Completer
func (*StringsOption) GetCompletesIds ¶ added in v1.122.0
func (base *StringsOption) GetCompletesIds() bool
func (*StringsOption) GetDefault ¶
func (base *StringsOption) GetDefault() *string
func (*StringsOption) GetHidden ¶ added in v1.42.0
func (base *StringsOption) GetHidden() bool
GetHidden reports whether the option is kept out of what is shown to a person.
func (*StringsOption) GetLongName ¶
func (base *StringsOption) GetLongName() string
func (*StringsOption) GetMetavar ¶
func (base *StringsOption) GetMetavar() string
func (*StringsOption) GetRequired ¶
func (base *StringsOption) GetRequired() bool
func (*StringsOption) GetShortName ¶
func (base *StringsOption) GetShortName() string
GetShortName returns the option's short name, or the empty string when it has none. A zero ShortName must not render as "\x00": that is a name like any other, and every option lacking a short name would collide on it.
func (*StringsOption) Set ¶
func (stringsOption *StringsOption) Set(in string) error
func (*StringsOption) SetChoices ¶
func (base *StringsOption) SetChoices(choices ...string)
func (*StringsOption) SetCompleter ¶ added in v1.122.0
func (*StringsOption) SetDefault ¶
func (base *StringsOption) SetDefault(value string)
func (*StringsOption) SetHidden ¶ added in v1.42.0
func (base *StringsOption) SetHidden(hidden bool)
func (*StringsOption) SetIsPure ¶ added in v1.122.0
func (*StringsOption) SetIsPure()
SetIsPure marks Set as recording the value and nothing more.
func (*StringsOption) SetMetavar ¶
func (base *StringsOption) SetMetavar(metavar string)