-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Feature request: add a command-line option to force case-sensitive search #124
Comments
Should it also override the On Sep 28, 2016 3:30 AM, "jeberger" [email protected] wrote:
|
Is it possible to have the last flag win? The idea is to allow a user to override whatever is in the alias.
|
Sadly, no, although I agree that might be more intuitive. We'd probably have to switch arg parsing libraries. Docopt doesn't expose that kind of information. |
Just a thought... most of the time this won't happen so if you detect both flags as being set you could just loop through argv and manually take the last one? Not very clean but it would work without requiring a new library. |
Yeah, I don't really want to add that implementation complexity. We should either do it right (switch to a different arg parsing library, which I don't really want to do) or just specify a precedence. Let's punt on "last flag wins for now" and decide on precedence. I feel like the precedence should be:
where flags earlier in the list override flags later in the list. |
That precedence will work for my use case too where I have On a different note. Would you also please add Update: because I like tables :)
|
Since we can't have "last flag wins", that precedence would be fine. And +1 for the short alias for |
This is done and will be in the next release. I implemented the precedence rules discussed here and made |
Thank you! Made case-insensitive my default |
Rationale: I would prefer smart case to be the default. I can get that by creating an alias like
alias rg="rg -S"
but then I need some way to force case-sensitive search when I need it e.g.rg --case-sensitive
, which given the alias would becomerg -S --case-sensitive
, the last given flag would then override previous flags.The text was updated successfully, but these errors were encountered: