MCPcopy Create free account
hub / github.com/GongShichen/LuminaCode / extractSedFileArgs

Function extractSedFileArgs

tools/bash/sed_validation.go:165–187  ·  view source on GitHub ↗
(command string)

Source from the content-addressed store, hash-verified

163}
164
165func 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
189func parseSedSubstituteFlags(expr string) (string, bool) {
190 if len(expr) < 4 || expr[0] != 's' {

Callers 1

ValidateSedCommandFunction · 0.85

Calls 2

TokenizeFunction · 0.85
looksLikeSedScriptFunction · 0.85

Tested by

no test coverage detected