Documentation
¶
Index ¶
- func ArgumentsMapKeys(inputs map[string]argument.InputArgument) []string
- type ArgvInput
- func (i *ArgvInput) Argument(name string) string
- func (i *ArgvInput) ArgumentArrays() map[string][]string
- func (i *ArgvInput) ArgumentList(name string) []string
- func (i *ArgvInput) Arguments() map[string]string
- func (i *ArgvInput) Bind(def definition.InputDefinition)
- func (i *ArgvInput) Definition() *definition.InputDefinition
- func (i *ArgvInput) FirstArgument() string
- func (i *ArgvInput) HasArgument(name string) bool
- func (i *ArgvInput) HasOption(name string) bool
- func (i *ArgvInput) HasParameterOption(values []string, onlyParams bool) bool
- func (i *ArgvInput) IsInteractive() bool
- func (i *ArgvInput) Option(name string) string
- func (i *ArgvInput) OptionList(name string) []string
- func (i *ArgvInput) OptionLists() map[string][]string
- func (i *ArgvInput) Options() map[string]string
- func (i *ArgvInput) ParameterOption(values []string, defaultValue string, onlyParams bool)
- func (i *ArgvInput) Parse()
- func (i *ArgvInput) ParseArgv()
- func (i *ArgvInput) SetArgument(name string, value string)
- func (i *ArgvInput) SetArgumentList(name string, value []string)
- func (i *ArgvInput) SetInteractive(interactive bool)
- func (i *ArgvInput) SetOption(name string, value string)
- func (i *ArgvInput) SetOptionList(name string, value []string)
- func (i *ArgvInput) Validate()
- type InputInterface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ArgumentsMapKeys ¶
func ArgumentsMapKeys(inputs map[string]argument.InputArgument) []string
Types ¶
type ArgvInput ¶
type ArgvInput struct {
// contains filtered or unexported fields
}
ArgvInput represents an input coming from the CLI arguments
func (*ArgvInput) ArgumentArrays ¶
get all parsed arguments array
func (*ArgvInput) ArgumentList ¶
Returns the argument array value for a given argument name
func (*ArgvInput) Bind ¶
func (i *ArgvInput) Bind(def definition.InputDefinition)
Binds the current input instance with the given arguments and options
func (*ArgvInput) Definition ¶
func (i *ArgvInput) Definition() *definition.InputDefinition
get the input definition
func (*ArgvInput) FirstArgument ¶
Returns the first argument from the raw parameters (not parsed)
func (*ArgvInput) HasArgument ¶
Returns true if an InputArgument object exists by name or position
func (*ArgvInput) HasParameterOption ¶
Returns true if the raw parameters (not parsed) contain a value
func (*ArgvInput) IsInteractive ¶
func (i *ArgvInput) IsInteractive() bool
Is this input means interactive?
func (*ArgvInput) OptionList ¶
Returns the option array value for a given option name
func (*ArgvInput) OptionLists ¶
Returns all the given options array merged with the default values
func (*ArgvInput) ParameterOption ¶
Returns the value of a raw option (not parsed).
func (*ArgvInput) SetArgument ¶
Sets an argument value by name
func (*ArgvInput) SetArgumentList ¶
Sets an argument array value by name
func (*ArgvInput) SetInteractive ¶
func (i *ArgvInput) SetInteractive(interactive bool)
Sets the input interactivity
func (*ArgvInput) SetOptionList ¶
Sets an option array value by name
type InputInterface ¶
type InputInterface interface {
// Returns the first argument from the raw parameters (not parsed).
FirstArgument() string
// Returns true if the raw parameters (not parsed) contain a value.
//
// This method is to be used to introspect the input parameters
// before they have been validated. It must be used carefully.
// Does not necessarily return the correct result for short options
// when multiple flags are combined in the same option.
HasParameterOption(values []string, onlyParams bool) bool
// Returns the value of a raw option (not parsed).
//
// This method is to be used to introspect the input parameters
// before they have been validated. It must be used carefully.
// Does not necessarily return the correct result for short options
// when multiple flags are combined in the same option.
ParameterOption(values []string, defaultValue string, onlyParams bool)
// Binds the current input instance with the given arguments and options.
Bind(definition definition.InputDefinition)
// Validates the input.
Validate()
// Parse the input data
Parse()
// Returns all the given arguments merged with the default values.
Arguments() map[string]string
// Returns all the given array arguments merged with the default values.
ArgumentArrays() map[string][]string
// Returns the argument value for a given argument name.
Argument(name string) string
// Returns the argument array value for a given array argument name.
ArgumentList(name string) []string
// Set the argument value for a given argument name.
SetArgument(name string, value string)
// Set the argument value for a given array argument name.
SetArgumentList(name string, value []string)
// Returns the argument value for a given argument name.
HasArgument(name string) bool
// Returns all the given options merged with the default values.
Options() map[string]string
// Returns all the given array options merged with the default values.
OptionLists() map[string][]string
// Returns the option value for a given option name.
Option(name string) string
// Returns the option array value for a given array option name.
OptionList(name string) []string
// Sets an option value by name.
SetOption(name string, value string)
// Sets an array option value by name.
SetOptionList(name string, value []string)
// Returns true if an InputOption object exists by name.
HasOption(name string) bool
// Is this input means interactive?
IsInteractive() bool
// Sets the input interactivity.
SetInteractive(bool)
// Get the input definition
Definition() *definition.InputDefinition
}
InputInterface is the interface implemented by all input classes.