fix: dont include quotes in cmd arguments, so my commits are fixed now lmaoooo

pull/5/head
TorchedSammy 2021-03-20 22:00:39 -04:00
parent 93ce2a9cef
commit 623b46fb8e
1 changed files with 14 additions and 4 deletions

18
main.go
View File

@ -69,14 +69,24 @@ func main() {
if err == nil { continue } if err == nil { continue }
quoted := false quoted := false
q := func(r rune) bool { cmdArgs := []string{}
sb := &strings.Builder{}
for _, r := range cmdString {
if r == '"' { if r == '"' {
quoted = !quoted quoted = !quoted
// dont add back quotes
//sb.WriteRune(r)
} else if !quoted && r == ' ' {
cmdArgs = append(cmdArgs, sb.String())
sb.Reset()
} else {
sb.WriteRune(r)
} }
return !quoted && r == ' '
} }
if sb.Len() > 0 {
cmdArgs := strings.FieldsFunc(cmdString, q) cmdArgs = append(cmdArgs, sb.String())
}
if len(cmdArgs) == 0 { continue } if len(cmdArgs) == 0 { continue }