Documentation ¶
Index ¶
- Variables
- type ArgValue
- func (i ArgValue) Float32() (float32, error)
- func (i ArgValue) Float64() (float64, error)
- func (i ArgValue) Int16() (int16, error)
- func (i ArgValue) Int32() (int32, error)
- func (i ArgValue) Int64() (int64, error)
- func (i ArgValue) Int8() (int8, error)
- func (i ArgValue) String() string
- func (i ArgValue) Uint16() (uint16, error)
- func (i ArgValue) Uint32() (uint32, error)
- func (i ArgValue) Uint64() (uint64, error)
- func (i ArgValue) Uint8() (uint8, error)
- type Argument
- type ArgumentOpt
- type Placeholder
- type PlaceholderOpt
- type Result
- func (i *Result) FlagArgValue(name coty.NameFlag) (value ArgValue, err error)
- func (i *Result) FlagArgValues(name coty.NameFlag) (values []ArgValue, err error)
- func (i *Result) GetCommandMainName() coty.NameCommand
- func (i *Result) GetPlaceholdersByIDs() map[coty.IDPlaceholder]*Placeholder
- func (i *Result) PlaceholderArgValue(id coty.IDPlaceholder) (value ArgValue, err error)
- func (i *Result) PlaceholderArgValues(id coty.IDPlaceholder) (values []ArgValue, err error)
- func (i *Result) PlaceholderByID(id coty.IDPlaceholder) *Placeholder
- type ResultOpt
- func (opt *ResultOpt) PlaceholderByID(argGroupID coty.IDPlaceholder) *PlaceholderOpt
- func (opt *ResultOpt) PlaceholderDoesNotHaveArgs(argGroupID coty.IDPlaceholder) bool
- func (opt *ResultOpt) SetArg(argGroupID coty.IDPlaceholder, arg ArgValue)
- func (opt *ResultOpt) SetFlagName(placeholderID coty.IDPlaceholder, flag coty.NameFlag)
Constants ¶
This section is empty.
Variables ¶
var ( // ErrFlagArgValuesNilPointer - call by nil pointer ErrFlagArgValuesNilPointer = errors.New(`Result.FlagArgValues error: Result pointer is nil`) // ErrFlagArgValuesNoArgValues - placeholder doesn't contain parsed arguments ErrFlagArgValuesNoArgValues = errors.New(`Result.FlagArgValues error: placeholder doesn't contain parsed arguments`) // ErrFlagArgValuesNoPlaceholder - placeholder is not found by nameFlag ErrFlagArgValuesNoPlaceholder = errors.New(`Result.FlagArgValues error: placeholder is not found`) )
var ( // ErrPlaceholderArgValuesNilPointer - call by nil pointer ErrPlaceholderArgValuesNilPointer = errors.New(`Result.PlaceholderArgValues error: Result pointer is nil`) // ErrPlaceholderArgValuesNoArgValues - placeholder doesn't contain parsed arguments ErrPlaceholderArgValuesNoArgValues = errors.New(`Result.PlaceholderArgValues error: placeholder doesn't contain parsed arguments`) // ErrPlaceholderArgValuesNoPlaceholder - placeholder is not found by nameFlag ErrPlaceholderArgValuesNoPlaceholder = errors.New(`Result.PlaceholderArgValues error: placeholder is not found`) )
Functions ¶
This section is empty.
Types ¶
type ArgValue ¶
type ArgValue string
ArgValue - string value of an argument
const ArgValueDefault ArgValue = ""
ArgValueDefault - default value of ArgValue type
func MakeArgValue ¶
MakeArgValue constructs ArgValue from Argument
func RandArgValueSecond ¶
func RandArgValueSecond() ArgValue
RandArgValueSecond returns random ArgValue
func RandArgValueThird ¶
func RandArgValueThird() ArgValue
RandArgValueThird returns random ArgValue
type Argument ¶
type Argument struct {
// contains filtered or unexported fields
}
Argument contains parsed argument values of a nameMainCommand or a flagName
func MakeArgument ¶
func MakeArgument(opt *ArgumentOpt) *Argument
MakeArgument converts opt to Result pointer
func (*Argument) GetArgValues ¶
GetArgValues gets ArgValues field
type ArgumentOpt ¶
type ArgumentOpt struct {
ArgValues []ArgValue
}
ArgumentOpt contains source data for cast to Argument
type Placeholder ¶
type Placeholder struct {
// contains filtered or unexported fields
}
Placeholder contains parsed flagName and arguments array
func NewPlaceholder ¶
func NewPlaceholder(opt *PlaceholderOpt) *Placeholder
NewPlaceholder converts opt to Placeholder pointer
func (*Placeholder) GetArgData ¶
func (p *Placeholder) GetArgData() *Argument
GetArgData gets Argument field
func (*Placeholder) GetNameFlag ¶
func (p *Placeholder) GetNameFlag() coty.NameFlag
GetNameFlag gets flagName field
func (*Placeholder) HasArg ¶
func (p *Placeholder) HasArg() bool
HasArg returns if Placeholder has Argument option
func (*Placeholder) HasFlag ¶
func (p *Placeholder) HasFlag() bool
HasFlag returns if Placeholder has Flag option
type PlaceholderOpt ¶
type PlaceholderOpt struct { ID coty.IDPlaceholder Flag coty.NameFlag Argument *ArgumentOpt }
PlaceholderOpt contains source data for cast to Placeholder
type Result ¶
type Result struct {
// contains filtered or unexported fields
}
Result contains a result of nameMainCommand line arguments parsing
func (*Result) FlagArgValue ¶
FlagArgValue extracts flagName argument value
func (*Result) FlagArgValues ¶
FlagArgValues - extract flagName argument value slice
func (*Result) GetCommandMainName ¶
func (i *Result) GetCommandMainName() coty.NameCommand
GetCommandMainName gets nameMainCommand field
func (*Result) GetPlaceholdersByIDs ¶
func (i *Result) GetPlaceholdersByIDs() map[coty.IDPlaceholder]*Placeholder
GetPlaceholdersByIDs gets placeholdersByIDs field
func (*Result) PlaceholderArgValue ¶
func (i *Result) PlaceholderArgValue(id coty.IDPlaceholder) (value ArgValue, err error)
func (*Result) PlaceholderArgValues ¶
func (i *Result) PlaceholderArgValues(id coty.IDPlaceholder) (values []ArgValue, err error)
func (*Result) PlaceholderByID ¶
func (i *Result) PlaceholderByID(id coty.IDPlaceholder) *Placeholder
PlaceholderByID returns Placeholder by IDPlaceholder
type ResultOpt ¶
type ResultOpt struct { CommandMainName coty.NameCommand PlaceholdersByID map[coty.IDPlaceholder]*PlaceholderOpt }
ResultOpt contains source data for cast to Result
func (*ResultOpt) PlaceholderByID ¶
func (opt *ResultOpt) PlaceholderByID(argGroupID coty.IDPlaceholder) *PlaceholderOpt
PlaceholderByID returns Placeholder by IDPlaceholder
func (*ResultOpt) PlaceholderDoesNotHaveArgs ¶
func (opt *ResultOpt) PlaceholderDoesNotHaveArgs(argGroupID coty.IDPlaceholder) bool
PlaceholderDoesNotHaveArgs returns if the group with argGroupID doesn't have arguments
func (*ResultOpt) SetArg ¶
func (opt *ResultOpt) SetArg(argGroupID coty.IDPlaceholder, arg ArgValue)
SetArg sets ArgValue into Placeholder by IDPlaceholder
func (*ResultOpt) SetFlagName ¶
func (opt *ResultOpt) SetFlagName(placeholderID coty.IDPlaceholder, flag coty.NameFlag)
SetFlagName sets NameFlag into Placeholder by IDPlaceholder