add map input

This commit is contained in:
2020-11-01 18:57:35 +03:00
parent 50df7ec000
commit 596026ae92
9 changed files with 128 additions and 123 deletions

View File

@@ -2,7 +2,6 @@ package input
import (
"context"
"log"
"gitoa.ru/go-4devs/console/input/value"
)
@@ -14,15 +13,13 @@ func Chain(c ...Input) Input {
type chain []Input
func (c chain) Option(ctx context.Context, name string) value.Value {
log.Println(name, len(c))
for _, in := range c {
log.Printf("%T\n", in)
if val := in.Option(ctx, name); !value.IsEmpty(val) {
return val
}
}
return value.Empty
return value.Empty()
}
func (c chain) Argument(ctx context.Context, name string) value.Value {
@@ -32,7 +29,7 @@ func (c chain) Argument(ctx context.Context, name string) value.Value {
}
}
return value.Empty
return value.Empty()
}
func (c chain) Bind(ctx context.Context, def *Definition) error {