Closed tunnckoCore closed 9 years ago
@jonschlinkert I realize that we have this feature with {"js,md,txt"}
syntax.
Actually, need to escape \
(backslash).
hm...
I want/expect this result:
[
'a/b/*.{js,md,txt}',
'a/c/*.{js,md,txt}',
'a/e/d/*.{js,md,txt}',
'a/d/*.{js,md,txt}'
]
how?
var braces = require('braces');
braces('a/{b,{c,d},e/d}/*.{"js,md,txt"}')
//=> [ 'a/{b,{c,d},e/d}/*.{js,md,txt}' ]
expand nothing.
What is the use case?
Sent from my iPhone
On Jan 17, 2015, at 9:48 AM, Charlike Mike Reagent notifications@github.com wrote:
I want/expect this result:
[ 'a/b/.{js,md,txt}', 'a/c/.{js,md,txt}', 'a/e/d/.{js,md,txt}', 'a/d/.{js,md,txt}' ] how?
var braces = require('braces'); braces('a/{b,{c,d},e/d}/.{"js,md,txt"}') //=> [ 'a/{b,{c,d},e/d}/.{js,md,txt}' ] expand nothing.
— Reply to this email directly or view it on GitHub.
Generating fixtures, lol.
Because (shown above)
writeFixture('short.js', 'fixtures/a/{b,{c,d},e/d}/*.{js,md,txt}');
results
[
"fixtures/a/b/*.js",
"fixtures/a/c/*.js",
"fixtures/a/e/d/*.js",
"fixtures/a/d/*.js",
"fixtures/a/b/*.md",
"fixtures/a/c/*.md",
"fixtures/a/e/d/*.md",
"fixtures/a/d/*.md",
"fixtures/a/b/*.txt",
"fixtures/a/c/*.txt",
"fixtures/a/e/d/*.txt",
"fixtures/a/d/*.txt"
]
too much, in one side; on other hand purpose is to pass it then to matching lib (or glob-fs, cuz im workin on somthing) huh..
Okey, again, lol. In one hand, we can use one pattern to generate file system fixtures and in another hand with same pattern to generate string fixtures (patterns) that we can pass to matching lib.
Or in short: reusing (same) patterns
:-1: for me today ;d
writeFixture('short.js', 'fixtures/a/{b,{c,d},e/d}/*.{"js,md,txt"}');
fixtures/a/b/file-a-b.js
fixtures/a/b/file-a-b.md
fixtures/a/b/file-a-b.txt
fixtures/a/c/file-a-c.js
fixtures/a/c/file-a-c.md
fixtures/a/c/file-a-c.txt
fixtures/a/d/file-a-d.js
fixtures/a/d/file-a-d.md
fixtures/a/d/file-a-d.txt
fixtures/a/e/d/file-a-e-d.js
fixtures/a/e/d/file-a-e-d.md
fixtures/a/e/d/file-a-e-d.txt
short.js
with contentmodule.exports = [
[
'fixtures/a/b/*.{js,md,txt}',
'fixtures/a/c/*.{js,md,txt}',
'fixtures/a/e/d/*.{js,md,txt}',
'fixtures/a/d/*.{js,md,txt}'
]
];
then we can "reuse" the pattern
With one pattern, two jobs.
Try using the makeRe option. I'll link to it in a bit
Sent from my iPhone
On Jan 17, 2015, at 12:58 PM, Charlike Mike Reagent notifications@github.com wrote:
writeFixture('short.js', 'fixtures/a/{b,{c,d},e/d}/*.{"js,md,txt"}'); (step one) generates file system files and folders, structured fixtures/a/b/file-a-b.js fixtures/a/c/file-a-c.js fixtures/a/e/d/file-a-e-d.js fixtures/a/d/file-a-d.js
fixtures/a/b/file-a-b.md fixtures/a/c/file-a-c.md fixtures/a/e/d/file-a-e-d.md fixtures/a/d/file-a-d.md
fixtures/a/b/file-a-b.txt fixtures/a/c/file-a-c.txt fixtures/a/e/d/file-a-e-d.txt fixtures/a/d/file-a-d.txt (step two) creates short.js with content module.exports = [ [ 'fixtures/a/b/.{js,md,txt}', 'fixtures/a/c/.{js,md,txt}', 'fixtures/a/e/d/.{js,md,txt}', 'fixtures/a/d/.{js,md,txt}' ] ]; then we can "reuse" the (semi-expanded) pattern
— Reply to this email directly or view it on GitHub.
are you using a single backslash, or two? when you escape in a string you need \\
. see https://github.com/jonschlinkert/braces/blob/master/test/test.js#L154-L181.
Seems like there might be a better way to do what you're trying to achieve. If not, then we can add as a feature request.
Generating fixtures,
and yeah, I got that lol. What I meant earlier was, why are you trying to "half" expand the globs? it seems over-engineered. Just make two patterns for each test - one to create the fixtures and one to match them.
it seems over-engineered
Maybe, lol. Nevermind, I'll clear the situation in my head ;d
Thanks!
We need something like this
then we can pass the string to globbing lib, eg micromatch.
With single slash it removes it, with two
\\
, not works. The result is