Closed isaacs closed 9 years ago
were you using the minimatch branch?
I get [ 'aa', 'ab', 'ba', 'bb' ]
Yeah, that's incorrect. I think the avoidance of duplicates is the problem here, and probably a whole new strategy is needed.
Looking at the bash source code (braces.c, which is a bit of a convoluted mess with gotos and breaks out of a do/while and so on, but whatever) it looks like the process is something like this:
$ echo {a,b}{{a,b},a,b}
aa ab aa ab ba bb ba bb
$ echo a{{a,b},a,b} b{{a,b},a,b}
aa ab aa ab ba bb ba bb
$ echo a{a,b} aa ab b{a,b} ba bb
aa ab aa ab ba bb ba bb
$ echo aa ab aa ab ba bb ba bb
aa ab aa ab ba bb ba bb
That is:
{
character, and then get the bit before and after the braced set, and the braced set.{
remain.If I get a chance between family and holiday travel this week, I'll take a crack at a poc.
thanks for clarifying. yeah obviously I was trying to eliminate dupes, from my frame of reference that made sense. I'll try to come up with ideas too. and no hurry on my end! enjoy the holiday!
btw, thanks for taking the time to look at the code and review. I really appreciate it. I'm always looking for opportunities to learn.
Happy to help! Making node-glob 100% identical to Bash has become a mildly obsessive hobby for me lately. It's more entertaining than TV ;)
has become a mildly obsessive hobby
Lol, I know exactly what you mean. we do the same with commonmark on remarkable. as a "higher power", deferring to commonmark makes syntax decisions super easy.
On a related topic (bash coverage), I thought of something related earlier that seems really interesting and wanted to run it by you. Any interest in collaborating on a minimatch lib with a reduced feature set? e.g. micromatch
? just for fun, no expectations or whatever.
you would know this better than me, but I would guess that the majortity of minimatch users use a handful of the features. So my thinking is that micromatch could fill a niche to focus specifically on speed, and only offer support for a specific set of globbing/brace expansion features. seems like this would make decisions in both libs easier regarding features/support. just a thought
closing since this is the behavior we want in braces, e.g. node.js versus bash.