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.
22 lines
255 B
22 lines
255 B
4 years ago
|
package value
|
||
|
|
||
|
import "gitoa.ru/go-4devs/console/input"
|
||
|
|
||
|
type Any struct {
|
||
|
Empty
|
||
|
Val []interface{}
|
||
|
Flag input.Flag
|
||
|
}
|
||
|
|
||
|
func (a *Any) Any() interface{} {
|
||
|
if a.Flag.IsArray() {
|
||
|
return a.Val
|
||
|
}
|
||
|
|
||
|
if len(a.Val) > 0 {
|
||
|
return a.Val[0]
|
||
|
}
|
||
|
|
||
|
return nil
|
||
|
}
|