Skip to content
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

Unable to use query starting with "-" #482

Closed
RalfJung opened this issue May 15, 2017 · 3 comments
Closed

Unable to use query starting with "-" #482

RalfJung opened this issue May 15, 2017 · 3 comments
Labels
bug A bug.

Comments

@RalfJung
Copy link
Contributor

Calling rg -e -- (to search for all occurrences of "--") fails with

$ rg -e "--"
error: The argument '--regexp <pattern>...' requires a value but none was supplied

In contrast, the same pattern works for the usual GNU-style tools:

$  egrep -e "--" -R .
...

I am aware that I can work around this issue using e.g. [-]- as the pattern, but that should not be necessary.

@BurntSushi
Copy link
Owner

This might be a clap bug. Note that rg -e - works.

cc @kbknapp

@kbknapp
Copy link
Contributor

kbknapp commented May 15, 2017

It looks like it's due to the special casing of -- meaning "only free args follow" taking precedence over the -e allowing values to start with -. This should be a decently easy fix, I think I can knock it out later today if all goes well.

@BurntSushi
Copy link
Owner

BurntSushi commented May 15, 2017

@kbknapp If there were ever an example of a low priority bug, this would be it. :-) Thank you all the same though!

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

No branches or pull requests

3 participants