$ 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.
This would be nice:
The current behavior when no arguments are given (to look for all
*.js
files in the current working directory) could still be honored ifstandard-format
checkedstdin
: 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 fromstdin
. Specifying option-w
in this case would exclude the check for content onstdin
. Also, perhaps a nice addition would be to accept filename-
, which would mean "only read fromstdin
"; in this case, it would be inconsistent to also specify-w
, which could either be ignored or the program could return an error code.