You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
463 B
27 lines
463 B
4 years ago
|
package argument
|
||
|
|
||
|
import (
|
||
|
"gitoa.ru/go-4devs/console/input"
|
||
|
"gitoa.ru/go-4devs/console/input/value"
|
||
|
)
|
||
|
|
||
|
func Required(a *input.Argument) {
|
||
|
a.Flag |= input.ValueRequired
|
||
|
}
|
||
|
|
||
|
func Default(v interface{}) func(*input.Argument) {
|
||
|
return func(a *input.Argument) {
|
||
|
a.Default = value.New(v)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func Flag(flag input.Flag) func(*input.Argument) {
|
||
|
return func(a *input.Argument) {
|
||
|
a.Flag = flag
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func Array(a *input.Argument) {
|
||
|
a.Flag |= input.ValueArray
|
||
|
}
|