(command string)
| 163 | } |
| 164 | |
| 165 | func extractSedFileArgs(command string) []string { |
| 166 | tokens := Tokenize(command, true) |
| 167 | var files []string |
| 168 | pastScript := false |
| 169 | for _, token := range tokens { |
| 170 | switch { |
| 171 | case token == "sed": |
| 172 | continue |
| 173 | case token == "-i" || token == "--in-place" || regexp.MustCompile(`^-i\.`).MatchString(token): |
| 174 | continue |
| 175 | case token == "-n" || token == "--quiet" || token == "--silent" || token == "-e" || token == "--expression" || token == "-f" || token == "--file": |
| 176 | continue |
| 177 | case strings.HasPrefix(token, "-") && len(token) > 1 && token[1] != '-': |
| 178 | continue |
| 179 | case looksLikeSedScript(token): |
| 180 | pastScript = true |
| 181 | continue |
| 182 | case pastScript: |
| 183 | files = append(files, token) |
| 184 | } |
| 185 | } |
| 186 | return files |
| 187 | } |
| 188 | |
| 189 | func parseSedSubstituteFlags(expr string) (string, bool) { |
| 190 | if len(expr) < 4 || expr[0] != 's' { |
no test coverage detected