Skip to content

Suggestion: Allow Certain Operators to Be Parsed as Tokens #57

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
eugene-yzm opened this issue Jun 16, 2023 · 0 comments
Open

Suggestion: Allow Certain Operators to Be Parsed as Tokens #57

eugene-yzm opened this issue Jun 16, 2023 · 0 comments

Comments

@eugene-yzm
Copy link

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant