go-shellwords
go-shellwords copied to clipboard
Suggestion: Allow Certain Operators to Be Parsed as Tokens
Specifically, I was testing:
s := "pg_dump db -U usr -F c > bck.dump"
argv, _ := shellwords.Parse(s)
for _, v := range argv {
println(v)
}
Which returned:
pg_dump
db
-U
usr
-F
c
I noticed in the source code (https://github.com/mattn/go-shellwords/blob/master/shellwords.go#L246) that we're not accepting ">" as a token amongst other characters like "|". Since these characters are very important in certain contexts, I think it might make sense to add a flag which will recognize them as tokens (by flag I mean something similar to p.ParseBacktick = true).