max-mapper / standard-format

converts your code into Standard JavaScript Format
264 stars 59 forks source link

Allow input from stdin #168

Closed matthewadams closed 8 years ago

matthewadams commented 8 years ago

This would be nice:

$ echo "var x = {a:1,b:2}" | standard-format
var x = {a: 1, b: 2}

The current behavior when no arguments are given (to look for all *.js files in the current working directory) could still be honored if standard-format checked stdin: if nothing is there to be consumed, the program would default to current behavior, but, if there is content to be consumed, the program would take only from stdin. Specifying option -w in this case would exclude the check for content on stdin. Also, perhaps a nice addition would be to accept filename -, which would mean "only read from stdin"; in this case, it would be inconsistent to also specify -w, which could either be ignored or the program could return an error code.

matthewadams commented 8 years ago

OMG just saw https://github.com/maxogden/standard-format/issues/117. Nevermind. See https://github.com/maxogden/standard-format/issues/169.