// ConvertID converts the input id to []int. Similar to ConvertID
// Handle multiple values with format 2-4, 2,3,4
ConvertID converts the input id to []int. Similar to ConvertID
Handle multiple values with format 2-4, 2,3,4
// ConvertID converts the input id to [] int . Similar to ConvertID // Handle multiple values with format 2 - 4 2 3 4
func ConvertIDs(args []string) ([]int, error) {
	var (
		ids []int
		err error
	)
	if len(args) == 1 {
		in := args[0]
		if strings.Contains(in, "-") {
			splits := strings.Split(in, "-")
			if len(splits) == 2 {
				var one, two int
				num1 := splits[0]
				num2 := splits[1]
				one, err = strconv.Atoi(num1)
				if err != nil {
					return ids, err
				}
				two, err = strconv.Atoi(num2)
				if err != nil {
					return ids, err
				}
				numRange := makeRange(one, two)
				return numRange, nil
			} else {
				return ids, fmt.Errorf("Invalid task ID input - %s \n", args[0])
			}
		}
		if strings.Contains(in, ",") {
			splits := strings.Split(in, ",")
			for _, c := range splits {
				var id int
				id, err = strconv.Atoi(c)
				if err != nil {
					return ids, fmt.Errorf("Invalid task ID input - %s \n", args[0])
				}
				ids = append(ids, id)
			}
			return ids, nil
		}
		id, err := strconv.Atoi(in)
		if err != nil {
			return ids, fmt.Errorf("Invalid task ID input - %s \n", args[0])
		}
		ids = []int{id}
	} else {
		return ids, fmt.Errorf("Invalid task ID input - %v \n\n", strings.Join(args, ", "))
	}
	return ids, nil
}
func ConvertIDs ( args [ ] string ) ( [ ] int , error ) { var ( ids [ ] int err error ) if len ( args ) == 1 { in := args [ 0 ] if strings . Contains ( in , " " ) { splits := strings . Split ( in , " " ) if len ( splits ) == 2 { var one , two int num1 := splits [ 0 ] num2 := splits [ 1 ] one , err = strconv . Atoi ( num1 ) if err != nil { return ids , err } two , err = strconv . Atoi ( num2 ) if err != nil { return ids , err } numRange := makeRange ( one , two ) return numRange , nil } else { return ids , fmt . Errorf ( " \n " , args [ 0 ] ) } } if strings . Contains ( in , " " ) { splits := strings . Split ( in , " " ) for _ , c := range splits { var id int id , err = strconv . Atoi ( c ) if err != nil { return ids , fmt . Errorf ( " \n " , args [ 0 ] ) } ids = append ( ids , id ) } return ids , nil } id , err := strconv . Atoi ( in ) if err != nil { return ids , fmt . Errorf ( " \n " , args [ 0 ] ) } ids = [ ] int { id } } else { return ids , fmt . Errorf ( " \n \n " , strings . Join ( args , " " ) ) } return ids , nil }
ConvertID converts the input id to []int.
ConvertID converts the input id to [] int .
// Handle format like 2-4 // Handle format like 2,3,4 // Normal case, single id