(command string)
| 123 | var envAssignmentPattern = regexp.MustCompile(`^[A-Za-z_]\w*=`) |
| 124 | |
| 125 | func parseCommandStructure(command string) (string, []string) { |
| 126 | tokens := Tokenize(command, false) |
| 127 | if len(tokens) == 0 { |
| 128 | return "", nil |
| 129 | } |
| 130 | |
| 131 | idx := 0 |
| 132 | for idx < len(tokens) && envAssignmentPattern.MatchString(tokens[idx]) { |
| 133 | idx++ |
| 134 | } |
| 135 | |
| 136 | if idx >= len(tokens) { |
| 137 | return "", nil |
| 138 | } |
| 139 | |
| 140 | base := tokens[idx] |
| 141 | if slash := strings.LastIndex(base, "/"); slash >= 0 { |
| 142 | base = base[slash+1:] |
| 143 | } |
| 144 | |
| 145 | return base, tokens[idx+1:] |
| 146 | } |
| 147 | |
| 148 | func extractCDPaths(tokens []string) []string { |
| 149 | parts := []string{} |
no test coverage detected