(args []string)
| 872 | } |
| 873 | |
| 874 | func normalizeArgs(args []string) []string { |
| 875 | if len(args) == 0 { |
| 876 | return args |
| 877 | } |
| 878 | |
| 879 | options := make([]string, 0, len(args)) |
| 880 | positionals := make([]string, 0, len(args)) |
| 881 | |
| 882 | for i := 0; i < len(args); i++ { |
| 883 | arg := args[i] |
| 884 | if !strings.HasPrefix(arg, "-") || arg == "-" { |
| 885 | positionals = append(positionals, arg) |
| 886 | continue |
| 887 | } |
| 888 | |
| 889 | options = append(options, arg) |
| 890 | |
| 891 | if optionRequiresValue(arg) && i+1 < len(args) { |
| 892 | i++ |
| 893 | options = append(options, args[i]) |
| 894 | } |
| 895 | } |
| 896 | |
| 897 | return append(options, positionals...) |
| 898 | } |
| 899 | |
| 900 | func optionRequiresValue(arg string) bool { |
| 901 | if strings.HasPrefix(arg, "-in=") || strings.HasPrefix(arg, "--in=") { |
no test coverage detected