-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Fix braces #4632
Fix braces #4632
Conversation
This caused major annoyances with e.g. `find -exec`, and it's utterly useless - "{}" expands to nothing, so why have it at all? Fixes fish-shell#1109.
This was highly surprising. Fixes fish-shell#3002.
I've misplaced an empty line, sorry!
Note: The |
That is awesome, thanks for tackling this! I agree the alternating comma behavior is weird, I'm presuming Any chance you could implement #3802 while you're at it? |
Yes. Which is why I'm oblivious as to why the current behavior was a thing in the first place, and why this is rather unlikely to cause any issues in practice.
No. That would require touching the parser/tokenizer (since expand.cpp receives |
Description
This is a double-whammy to remove some of the annoyances from brace/bracket-expansion (the code calls it "brackets", I've only ever heard "braces" elsewhere).
It changes a literal
{}
to expand to itself, which fixes issue #1109, and makesfind -exec
nicer to use.It also changes it so successive commas in braces are seen as successive empty items, rather than alternating between an empty item and a literal ",". So
x{,,,}y
is no longer seen asxy x,y xy
(because the second "," is seen as a literal "," rather than a separator), but as "xy xy xy xy". That fixes #3002. (To get the literal comma, it can be\\
escaped or quoted still)Both of these are in the "theoretically backwards-incompatible, but unlikely to break stuff" category. The former especially will only break code that does useless stuff - currently a
{}
could be removed everywhere without any changes, so why have it at all?TODOs: