Documentation
¶
Index ¶
- type ArgvInput
- func (i *ArgvInput) Bind(def definition.InputDefinition)
- func (i *ArgvInput) GetArgument(name string) string
- func (i *ArgvInput) GetArgumentArray(name string) []string
- func (i *ArgvInput) GetArgumentArrays() map[string][]string
- func (i *ArgvInput) GetArguments() map[string]string
- func (i *ArgvInput) GetDefinition() *definition.InputDefinition
- func (i *ArgvInput) GetFirstArgument() string
- func (i *ArgvInput) GetOption(name string) string
- func (i *ArgvInput) GetOptionArray(name string) []string
- func (i *ArgvInput) GetOptionArrays() map[string][]string
- func (i *ArgvInput) GetOptions() map[string]string
- func (i *ArgvInput) GetParameterOption(values []string, defaultValue string, onlyParams bool)
- 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) Parse()
- func (i *ArgvInput) ParseArgv()
- func (i *ArgvInput) SetArgument(name string, value string)
- func (i *ArgvInput) SetArgumentArray(name string, value []string)
- func (i *ArgvInput) SetInteractive(interactive bool)
- func (i *ArgvInput) SetOption(name string, value string)
- func (i *ArgvInput) SetOptionArray(name string, value []string)
- func (i *ArgvInput) Validate()
- type InputInterface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ArgvInput ¶
type ArgvInput struct {
// contains filtered or unexported fields
}
ArgvInput represents an input coming from the CLI arguments
func (*ArgvInput) Bind ¶
func (i *ArgvInput) Bind(def definition.InputDefinition)
Binds the current Input instance with the given arguments and options
func (*ArgvInput) GetArgument ¶
Returns the argument value for a given argument name
func (*ArgvInput) GetArgumentArray ¶
Returns the argument array value for a given argument name
func (*ArgvInput) GetArgumentArrays ¶
get all parsed arguments array
func (*ArgvInput) GetArguments ¶
get all parsed arguments
func (*ArgvInput) GetDefinition ¶
func (i *ArgvInput) GetDefinition() *definition.InputDefinition
get the input definition
func (*ArgvInput) GetFirstArgument ¶
Returns the first argument from the raw parameters (not parsed)
func (*ArgvInput) GetOptionArray ¶
Returns the option array value for a given option name
func (*ArgvInput) GetOptionArrays ¶
Returns all the given options array merged with the default values
func (*ArgvInput) GetOptions ¶
Returns all the given options merged with the default values
func (*ArgvInput) GetParameterOption ¶
Returns the value of a raw option (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) SetArgument ¶
Sets an argument value by name
func (*ArgvInput) SetArgumentArray ¶
Sets an argument array value by name
func (*ArgvInput) SetInteractive ¶
func (i *ArgvInput) SetInteractive(interactive bool)
Sets the input interactivity
func (*ArgvInput) SetOptionArray ¶
Sets an option array value by name
type InputInterface ¶
type InputInterface interface {
// Returns the first argument from the raw parameters (not parsed).
GetFirstArgument() 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.
GetParameterOption(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.
GetArguments() map[string]string
// Returns all the given array arguments merged with the default values.
GetArgumentArrays() map[string][]string
// Returns the argument value for a given argument name.
GetArgument(name string) string
// Returns the argument array value for a given array argument name.
GetArgumentArray(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.
SetArgumentArray(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.
GetOptions() map[string]string
// Returns all the given array options merged with the default values.
GetOptionArrays() map[string][]string
// Returns the option value for a given option name.
GetOption(name string) string
// Returns the option array value for a given array option name.
GetOptionArray(name string) []string
// Sets an option value by name.
SetOption(name string, value string)
// Sets an array option value by name.
SetOptionArray(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
GetDefinition() *definition.InputDefinition
}
InputInterface is the interface implemented by all input classes.