// parseInput parses val as a slice of Inputs.
// Accepts int, string or a slice of them.
parseInput parses val as a slice of Inputs.
Accepts int, string or a slice of them.
// parseInput parses val as a slice of Inputs . // Accepts int string or a slice of them .
func parseInput(val interface{}, defaultFlag uint64) ([]Input, error) {
	switch val := val.(type) {
	case int:
		return []Input{
			{Key: val + '0'},
		}, nil
	case string:
		val = strings.ToLower(val)
		input, ok := inputMap[val]
		if !ok {
			break
		}
		if input.Flag == 0 {
			input.Flag = defaultFlag
		}
		return []Input{input}, nil
	case []interface{}:
		var inputs []Input
		for _, v := range val {
			input, err := parseInput(v, defaultFlag)
			if err != nil {
				return nil, err
			}
			inputs = append(inputs, input...)
		}
		return inputs, nil
	}
	return nil, errors.New("cannot parse as Input")
}
func parseInput ( val interface { } , defaultFlag uint64 ) ( [ ] Input , error ) { switch val := val . ( type ) { case int : return [ ] Input { { Key : val + '0' } , } , nil case string : val = strings . ToLower ( val ) input , ok := inputMap [ val ] if ! ok { break } if input . Flag == 0 { input . Flag = defaultFlag } return [ ] Input { input } , nil case [ ] interface { } : var inputs [ ] Input for _ , v := range val { input , err := parseInput ( v , defaultFlag ) if err != nil { return nil , err } inputs = append ( inputs , input ... ) } return inputs , nil } return nil , errors . New ( " " ) }
parseInput parses val as a slice of Inputs.
parseInput parses val as a slice of Inputs .