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
419 B

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