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

Function parseCommandStructure

tools/bash/validation.go:125–146  ·  view source on GitHub ↗
(command string)

Source from the content-addressed store, hash-verified

123var envAssignmentPattern = regexp.MustCompile(`^[A-Za-z_]\w*=`)
124
125func 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
148func extractCDPaths(tokens []string) []string {
149 parts := []string{}

Callers 1

ExtractPathsFunction · 0.85

Calls 1

TokenizeFunction · 0.85

Tested by

no test coverage detected