yajsv
yajsv copied to clipboard
Add flag for zero-output/exit code only
Would you be interested in a PR that adds an -e
flag that means "print nothing to standard out"?
My use case is using yajsv
in a CI pipeline. In which case I don't really want to see any output, I just want to know "did this exit with 0
?"
Thanks for making this available btw! It's very handy regardless!
There's already a -q
flag which only prints errors so if everything passes you get no output. If you really want zero output you can pipe to /dev/null
. I'd like to keep things simple and not add an option for something that is easily done from the shell.
I understand. Glad I asked :)
Thanks again!
I was aware of -q
, and this was my reasoning for why a new arg might make sense:
Most *nix command would be about as verbose as yajsv
is with the -q
option by default; then they would have a -v
flag to increase verbosity to the current default. In addition, they often have a flag like -s
code for "silent", but since -s
is already taken for defining a schema file, I chose -e
for "exit code only".
Thanks for the feedback. That's a good point about the the defaults maybe being too verbose since it prints every file processed. Now I'm wondering if -q
should be the default behavior where it only prints errors and failures. Then you explicitly opt into a verbose mode (unfortunately -v
is already taken for printing the version)
I'm going to reopen this and think on it.
See also https://github.com/neilpa/yajsv/issues/13#issuecomment-694932174 for adding additional output such as the text encoding in a verbose mode.