juliangruber/brace-expansion — pull request #1 by isaacs (2014-11-26 08:30:20+00:00)
Title: Bash comparison

This is actually an issue rather than a PR, per se, but I though it would be good to submit a failing test rather than just describe the issues.

I'm looking for a brace expansion module to replace the one in minimatch, because it's not identical enough to bash for my tastes. `brace-expansion` is closer, but still has some areas where it doesn't quite match how Bash expands braces.

There are 38 failing tests with this patch. They fall into a few categories, some of them probably easy to fix, some of them probably less easy.

* `{-001..5}` expands the negative values as `00-1` instead of `-001`
* Completely empty expansions are included in the set, but Bash elides those at the top level. `{a,b,}` is `a b` in bash, but `["a","b",""]` in brace-expand.
* In stepped range sets, brace-expand always includes the last item, but bash doesn't. So `{1..5..3}` expands to `1 4 5` when it should be `1 4`.
* The `\` char is included in character ranges, but bash excludes it.
* Double-braces are being treated as a single brace, so `{{a,b}}` expands to `a b` instead of `{a} {b}`.

And then a bunch of other stuff after those that's probably a lot trickier to fix :)

If your intent for this module is just to make it "good enough", then feel free to close this PR, and I'll take these tests I wrote and eventually make my own extremely strict bash-like brace-expansion thing.

Thanks!