ParseCommandLineList parses comma separated string lists which are passed in on the command line. Spaces are trimmed off both sides of result strings.
(input string)
| 32 | // in on the command line. Spaces are trimmed off both sides of result |
| 33 | // strings. |
| 34 | func ParseCommandLineList(input string) []string { |
| 35 | input = strings.TrimSpace(input) |
| 36 | if len(input) == 0 { |
| 37 | return nil |
| 38 | } |
| 39 | splitInput := strings.Split(input, ",") |
| 40 | args := make([]string, 0, len(splitInput)) |
| 41 | for _, s := range splitInput { |
| 42 | s = strings.TrimSpace(s) |
| 43 | if len(s) > 0 { |
| 44 | args = append(args, s) |
| 45 | } |
| 46 | } |
| 47 | return args |
| 48 | } |
| 49 | |
| 50 | // splitString splits a string along the specified separator, but it |
| 51 | // ignores anything between double quotes for splitting. We do simple |
no outgoing calls
no test coverage detected