1
0
mirror of https://github.com/nxshock/gron.git synced 2024-11-27 03:41:00 +05:00
gron/parser.go
2022-03-26 13:23:39 +05:00

21 lines
342 B
Go

package main
import (
"strings"
)
func parseCommand(s string) (command string, params []string) {
quoted := false
items := strings.FieldsFunc(s, func(r rune) bool {
if r == '"' {
quoted = !quoted
}
return !quoted && r == ' '
})
for i := range items {
items[i] = strings.Trim(items[i], `"`)
}
return items[0], items[1:]
}