first commit

This commit is contained in:
2020-10-25 10:00:59 +03:00
commit 0bd6f67397
80 changed files with 4741 additions and 0 deletions

44
input/option/option.go Normal file
View File

@@ -0,0 +1,44 @@
package option
import (
"gitoa.ru/go-4devs/console/input"
"gitoa.ru/go-4devs/console/input/value"
)
func Required(o *input.Option) {
o.Flag |= input.ValueRequired
}
func Default(in interface{}) func(*input.Option) {
return func(o *input.Option) {
o.Default = value.New(in)
}
}
func Short(s string) func(*input.Option) {
return func(o *input.Option) {
o.Short = s
}
}
func Array(o *input.Option) {
o.Flag |= input.ValueArray
}
func Value(flag input.Flag) func(*input.Option) {
return func(o *input.Option) {
o.Flag |= flag
}
}
func Flag(in input.Flag) func(*input.Option) {
return func(o *input.Option) {
o.Flag = in
}
}
func Valid(f ...func(input.Value) error) func(*input.Option) {
return func(o *input.Option) {
o.Valid = f
}
}