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.

69 lines
2.1 KiB

4 years ago
package option
import (
"gitoa.ru/go-4devs/console/input/value"
"gitoa.ru/go-4devs/console/input/variable"
4 years ago
)
func Short(in rune) variable.Option {
return func(v *variable.Variable) {
v.Alias = string(in)
4 years ago
}
}
func Default(in interface{}) variable.Option {
return variable.Default(value.New(in))
4 years ago
}
func Required(v *variable.Variable) {
variable.Required(v)
4 years ago
}
func Valid(f ...func(value.Value) error) variable.Option {
return variable.Valid(f...)
4 years ago
}
func Array(v *variable.Variable) {
variable.Array(v)
4 years ago
}
func String(name, description string, opts ...variable.Option) variable.Variable {
return variable.String(name, description, append(opts, variable.ArgOption)...)
4 years ago
}
4 years ago
func Bool(name, description string, opts ...variable.Option) variable.Variable {
return variable.Bool(name, description, append(opts, variable.ArgOption)...)
4 years ago
}
func Duration(name, description string, opts ...variable.Option) variable.Variable {
return variable.Duration(name, description, append(opts, variable.ArgOption)...)
4 years ago
}
func Float64(name, description string, opts ...variable.Option) variable.Variable {
return variable.Float64(name, description, append(opts, variable.ArgOption)...)
4 years ago
}
func Int(name, description string, opts ...variable.Option) variable.Variable {
return variable.Int(name, description, append(opts, variable.ArgOption)...)
4 years ago
}
func Int64(name, description string, opts ...variable.Option) variable.Variable {
return variable.Int64(name, description, append(opts, variable.ArgOption)...)
4 years ago
}
func Time(name, description string, opts ...variable.Option) variable.Variable {
return variable.Time(name, description, append(opts, variable.ArgOption)...)
4 years ago
}
func Uint(name, description string, opts ...variable.Option) variable.Variable {
return variable.Uint(name, description, append(opts, variable.ArgOption)...)
4 years ago
}
func Uint64(name, descriontion string, opts ...variable.Option) variable.Variable {
return variable.Uint64(name, descriontion, append(opts, variable.ArgOption)...)
}
4 years ago
func Err(name string, err error) variable.Error {
return variable.Err(name, variable.TypeOption, err)
4 years ago
}