-
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
Add globIgnore arg #26
Conversation
@@ -31,9 +31,9 @@ function clangFormat(file, enc, style, done) { | |||
function spawnClangFormat(args, done, stdio) { | |||
// WARNING: This function's interface should stay stable across versions for the cross-version | |||
// loading below to work. | |||
if (args.indexOf('-version') !== -1 || args.indexOf('--version') !== -1) { | |||
if (args.indexOf('--version') !== -1) { |
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.
This used to support -version
and --version
, please don't break that?
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.
I removed intercepting of -version
so that it could be passed onto the native binary (enabling getting it's version), and so that all intercepted commands would be the double-dash ones.
It's not very obvious at all without reading the readme though, and it is a breaking change. This is confined to the last commit so it should be easy to remove from the PR. Do you want me to do so?
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.
@mprobst can you still answer this?
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.
I think --version
and -version
should behave identically, and both give the version of the NPM package, i.e. should be intercepted.
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 modify to do that. I'll also squash everything into a single commit.
@alexeagle, maybe this is something for you, as you reviewed the original PR? |
Closing this out, I don't think we'll get to this. |
Following discussion on #25, I worked on adding an exclude functionality, and also wanted to always use
node-glob
for all patterns.When I was thinking about how to parse the args, I figured that a whitelist would be needed so that I could separate between what args to let through to the
clang-format
binary and which should I try to glob.I also tried to figure a good way to support multiple globs together with multiple ignore patterns, and it began sounding more difficult than I initially thought.
So I ended up only adding the
--globIgnore=
argument. I thought it would be simpler and more obvious. If a user wants nativeclang-format
behaviour he will use everything but the double dash args.This left out version. I refactored it so that
-version
is passed to the native binary, but--version
is used by the wrapper. This way the wrapper only has to process double dash args throughout.I also had to slightly refactor the tests to run on windows though, the path in
EXPECTED_VERSION_STRING
wasn't playing well with windows paths, but now it should work.This might be too much for a single PR but these changes followed one another so I left them.