-
Notifications
You must be signed in to change notification settings - Fork 32
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
feat: allow globbing #23
Conversation
|
||
$ clang-format --glob=folder/**/*.js | ||
|
||
This will run `clang-format` once per file result, and show the total |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to document what the globbing semantics are. It's sufficient to point to the docs for the glob library we use.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Roger, will add this.
Added link to glob semantics, chunking files in sets of 30, added serial execution of spawned processes. |
@@ -6,6 +6,8 @@ var os = require('os'); | |||
var path = require('path'); | |||
var resolve = require('resolve').sync; | |||
var spawn = require('child_process').spawn; | |||
var glob = require("glob"); | |||
var async = require("async"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems like a funny name for it now. Is the library worth having the dependency now, rather than just a for loop?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well the operation itself (spawning a child process and waiting for it to end) is still async so a simple for loop wouldn't work.
I could replicate async
's series functionality with a well crafted recursive function, but async
does it better and is more well tested so it seemed a better fit for this wrapper.
LGTM |
Close #21
Index 0 matching is in. But something seems breaking in the tests... give me a sec. |
Nvm, was just running the wrong tests. It's good to go. I don't have permissions, no. Could you perhaps do it? |
Merged in cfd69a8 - thanks!!! |
Sweet. |
|
||
This will run `clang-format` once per file result, and show the total | ||
formatted files at the end. | ||
See [node-glob](https://github.com/isaacs/node-glob) for globbing semantics. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just realized that we don't afford a way to pass options - I was just trying to write up an example and need exclude
...
Could you add docs that this is of course a Windows-only issue, and that on UNIXens including Macs the shell itself is doing the globbing? To that point, I think it might be smarter to not have |
The use case I have for this is in package.json
|
@alexeagle can you check if these proposal fits your needs? #25 (comment) (including @mprobst comment, that you probably have to expand the |
Close #21
Globbing files
This will run
clang-format
once per file result, and show the total formatted files at the end.