mirror of https://github.com/Hilbis/Hilbish
fix: dont include quotes in cmd arguments, so my commits are fixed now lmaoooo
parent
93ce2a9cef
commit
623b46fb8e
18
main.go
18
main.go
|
@ -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 }
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue