I have a simple CLI program that runs calculations on inputs from a text file and produces another text file for output. (I hope this isn't self-promotion, I can remove the link if its borderline!)
Unless directed otherwise, if you invoke it with filename.nec, it writes the output to filename.out. You can supply multiple files on the input line, or even a glob, so the automatic-name makes sense.
But it is also possible you might want to run it to stdout. This would be the default behaviour for most unix CLI programs (is that true?) I know there are some programs that automatically go to files, like gzip and such, and I'd like to match "the most standard behaviour" for this sort of thing.
Right now I have a -o flag so you can -o someotherfilename.out, and I re-wired that to allow - so you can do onec -o - inputfile.nec and then it goes to stdout.
Is that "right"? Or is there something else that people would expect?
[link] [comments]