You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for the report. This was previously discussed in #335
I'm not sure what to do in this case. Globs are a console feature, not a documentation.js feature. When you say documentation build ./src/editor/**/*.js, documentation receives that as documentation build ./src/editor/dir/file.js ./src/editor/dir/other-file.js: it doesn't do glob expansion.
Are you using Windows PowerShell or another type of shell in Windows? PowerShell should support globs as wikipedia says.
There are multiple possible actionables here:
If Windows supports globs but with different syntax, we can document and link that syntax
If this is truly essential, we can expand globs in documentation.js. I'm cautious to do this: this would break glob features in other systems and mean that we're targeting Windows. My previous efforts to target Windows have been unsuccessful because I never found a reliable way to continuously test Windows (I don't use Windows and none of our current core contributors do either). I will not introduce any Windows-specific workarounds with continuous integration tests.
Looking into the glob implementation here, but can you confirm which shell you're using in Windows? PowerShell should have support, as should cygwin.
This is troubling to me because of this case:
You're on a Linux or OSX system, using a shell with glob expansion
You have a file named foo*bar and a file named foobazbar
You run documentation build foo\*bar in a shell
node receives argv = ['foo*bar']
Now the behavior diverges whether I implement this feature
If we expand globs, then you get foo*bar and foobazbar
If we don't (as the behavior is currently), you get foo*bar
The problem here is:
Unix systems escape input like foo\*bar to foo*bar in argv[2]
Windows systems would also give you foo*bar and you'd want to expand that
Illustrative example:
test.js:
console.log(process.argv.slice(2));
output:
~/src/documentation〉node test foo\*bar
[ 'foo*bar' ]
~/src/documentation〉node test foo*bar
[ 'foo*bar', 'foobazbar' ]
So, implementing glob on all input naively would change OSX/Linux behavior in a way that makes it less precise: it would no longer be able to specify files that look like globs without expanding them as globs.
Very interested in if anyone has solutions here, of can write documentation for people to use Windows glob patterns to dodge this problem.
Activity
tmcw commentedon Nov 21, 2016
Thanks for the report. This was previously discussed in #335
I'm not sure what to do in this case. Globs are a console feature, not a documentation.js feature. When you say
documentation build ./src/editor/**/*.js, documentation receives that asdocumentation build ./src/editor/dir/file.js ./src/editor/dir/other-file.js: it doesn't do glob expansion.Are you using Windows PowerShell or another type of shell in Windows? PowerShell should support globs as wikipedia says.
There are multiple possible actionables here:
aeneasr commentedon Nov 21, 2016
Ah, sorry for the duplicate! How about using something like https://github.com/isaacs/node-glob in documentation.js?
tmcw commentedon Dec 9, 2016
Looking into the glob implementation here, but can you confirm which shell you're using in Windows? PowerShell should have support, as should cygwin.
This is troubling to me because of this case:
foo*barand a file namedfoobazbardocumentation build foo\*barin a shellnodereceives argv =['foo*bar']foo*barandfoobazbarfoo*barThe problem here is:
foo\*bartofoo*barin argv[2]foo*barand you'd want to expand thatIllustrative example:
test.js:
output:
So, implementing
globon all input naively would change OSX/Linux behavior in a way that makes it less precise: it would no longer be able to specify files that look like globs without expanding them as globs.Very interested in if anyone has solutions here, of can write documentation for people to use Windows glob patterns to dodge this problem.
feat(bin): Support globs on windows and use smarter recursion
tmcw commentedon Dec 9, 2016
eslint actually does this 🙌 , praise eslint!
The trick is:
The magic is in https://github.com/eslint/eslint/blob/master/lib/util/glob-util.js
Got an initial port of the eslint logic at #629
rowanwins commentedon Dec 12, 2016
Gday @tmcw
Just confirming that the glob issue does occur on windows even when using powershell.
I'll keep an eye on the issue and your pull request as am currently looking at tidying up the turf docs but I currently can't do anything with them :(
feat(bin): Support globs on windows and use smarter recursion
feat(bin): Support globs on windows and use smarter recursion
feat(bin): Support globs on windows and use smarter recursion
feat(bin): Support globs on windows and use smarter recursion (#629)