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.
|
|
|
package value
|
|
|
|
|
|
|
|
import "gitoa.ru/go-4devs/console/input/value/flag"
|
|
|
|
|
|
|
|
type String struct {
|
|
|
|
empty
|
|
|
|
Val []string
|
|
|
|
Flag flag.Flag
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *String) Append(in string) error {
|
|
|
|
s.Val = append(s.Val, in)
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *String) String() string {
|
|
|
|
if s.Flag.IsArray() {
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
|
|
|
|
if len(s.Val) == 1 {
|
|
|
|
return s.Val[0]
|
|
|
|
}
|
|
|
|
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *String) Strings() []string {
|
|
|
|
return s.Val
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *String) Any() interface{} {
|
|
|
|
if s.Flag.IsArray() {
|
|
|
|
return s.Strings()
|
|
|
|
}
|
|
|
|
|
|
|
|
return s.String()
|
|
|
|
}
|