add (opt|arg).Repeats()
This commit is contained in:
parent
4ffa7ba364
commit
58b225f25e
@ -182,6 +182,11 @@ func (arg *Argument) SetValue(value []string) {
|
|||||||
arg.provided = &value
|
arg.provided = &value
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Repeats tells if an argument should be presented as a list.
|
||||||
|
func (arg *Argument) Repeats() bool {
|
||||||
|
return arg.Variadic
|
||||||
|
}
|
||||||
|
|
||||||
func (arg *Argument) IsKnown() bool {
|
func (arg *Argument) IsKnown() bool {
|
||||||
return arg.provided != nil && len(*arg.provided) > 0
|
return arg.provided != nil && len(*arg.provided) > 0
|
||||||
}
|
}
|
||||||
|
@ -137,6 +137,11 @@ func (opt *Option) ToString() string {
|
|||||||
return stringValue
|
return stringValue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Repeats tells if an option should be presented as a list.
|
||||||
|
func (opt *Option) Repeats() bool {
|
||||||
|
return opt.Repeated
|
||||||
|
}
|
||||||
|
|
||||||
func (opt *Option) internalValidate(name, current string) error {
|
func (opt *Option) internalValidate(name, current string) error {
|
||||||
if current == "" {
|
if current == "" {
|
||||||
return nil
|
return nil
|
||||||
|
Loading…
Reference in New Issue
Block a user