-
Notifications
You must be signed in to change notification settings - Fork 510
binary: Accepts piped input from stdin. Fixes #448 #505
Conversation
@@ -62,7 +62,7 @@ module.exports = function(program) { | |||
return returnArgs; | |||
} | |||
|
|||
if (args.length === 0) { | |||
if (args.length === 0 && ! program._stdin) { |
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.
No space for unary operators.
@markelog, can you review this one? The CLI stuff is out of my area of expertise. |
@mikesherov @markelog I opted for the old style of processing stdin, similar to how CSS-Guard does it. Added more tests to ensure that all is well. |
@markelog any chance you can review this soon? |
I can check this out at monday. |
@mdevils did you get a chance to review this? I'd like to put out 1.5.10 at the end of the week and would love for this to get in. |
@@ -26,4 +28,19 @@ program | |||
.option('', '\t /path/to/my-reporter\t\t(absolute path without extension)') | |||
.parse(process.argv); | |||
|
|||
cli(program); | |||
if (process.argv.length <= 2) { |
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.
Very strange condition. Explain this please.
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 should probably be if (process.argv.length === 2)
.
This triggers the piped stdin processing if jscs
is invoked via node jscs
, as in, the jscs
command is invoked without arguments.
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.
@mdevils Modified the condition appropriately.
Actually, is checking for lack of arguments the only time we want JSCS should check stdin whenever a set of files aren't specified. |
I would suggest put all logic to cli module - check if we have |
|
@mikesherov @markelog @mdevils Made the adjustments. My only concern is that the added tests are slower (they're yellow in color) since they use Great tip on |
@mrjoelkemp LGTM to land. @markelog I'll wait for you or @mdevils to land it tomorrow. |
We can improve that later |
Issues
cat
'd is blankFixes #448