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.
|
|
|
package argument
|
|
|
|
|
|
|
|
import (
|
|
|
|
"gitoa.ru/go-4devs/console/input/flag"
|
|
|
|
"gitoa.ru/go-4devs/console/input/value"
|
|
|
|
)
|
|
|
|
|
|
|
|
func Required(a *Argument) {
|
|
|
|
a.Flag |= flag.Required
|
|
|
|
}
|
|
|
|
|
|
|
|
func Default(v interface{}) func(*Argument) {
|
|
|
|
return func(a *Argument) {
|
|
|
|
a.Default = value.New(v)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func Flag(flag flag.Flag) func(*Argument) {
|
|
|
|
return func(a *Argument) {
|
|
|
|
a.Flag = flag
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func Array(a *Argument) {
|
|
|
|
a.Flag |= flag.Array
|
|
|
|
}
|