From 7aaeb778719a56c2a48e11f8c38b3993282f4034 Mon Sep 17 00:00:00 2001 From: TorchedSammy <38820196+TorchedSammy@users.noreply.github.com> Date: Sat, 20 Mar 2021 03:14:06 -0400 Subject: [PATCH] "feat: fix double quotes being an issue in commands" --- main.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 0d98b2c..b61595d 100644 --- a/main.go +++ b/main.go @@ -59,7 +59,15 @@ func main() { 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 }