"feat: fix double quotes being an issue in commands"

pull/5/head
TorchedSammy 2021-03-20 03:14:06 -04:00
parent f0163fc2e9
commit 7aaeb77871
1 changed files with 9 additions and 1 deletions

10
main.go
View File

@ -59,7 +59,15 @@ func main() {
if err == nil { continue } if err == nil { continue }
cmdArgs := strings.Fields(cmdString) quoted := false
q := func(r rune) bool {
if r == '"' {
quoted = !quoted
}
return !quoted && r == ' '
}
cmdArgs := strings.FieldsFunc(cmdString, q)
if len(cmdArgs) == 0 { continue } if len(cmdArgs) == 0 { continue }