yajsv icon indicating copy to clipboard operation
yajsv copied to clipboard

Add flag for zero-output/exit code only

Open gabesullice opened this issue 4 years ago • 4 comments

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!

gabesullice avatar May 13 '20 23:05 gabesullice

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.

neilpa avatar May 14 '20 15:05 neilpa

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".

gabesullice avatar May 19 '20 18:05 gabesullice

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.

neilpa avatar May 19 '20 19:05 neilpa

See also https://github.com/neilpa/yajsv/issues/13#issuecomment-694932174 for adding additional output such as the text encoding in a verbose mode.

neilpa avatar Oct 06 '20 23:10 neilpa