TGViewer
Linux - Reddit Linux - Reddit @r_linux · 1.09K subscribers
Post #41730 47
Advice: CLI program defaults to writing a file, what if I want stdout?

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?

https://redd.it/1t6irk1
@r_linux
GitHub GitHub - maurymarkowitz/OpenNEC: C-language version of the Numerical Electromagnetics Code (NEC-2) with several extensions C-language version of the Numerical Electromagnetics Code (NEC-2) with several extensions - maurymarkowitz/OpenNEC
More from @r_linux
  1. Oct 18, 2026OpenXLR - The REAL alternative to WaveLink 3 on linux! 💕 /r/elgato/comments/1x70dja/openx…
  2. Oct 18, 2026Which app works well on Linux for streaming music? I want an app for my Fedora KDE that wo…
  3. Oct 18, 2026Glowbuffer - drag 'n drop & pasting fix for Hyprland /r/hyprland/comments/1x6602a/glowbuff…
  4. Oct 18, 2026SonicDE is a fork of KDE that aims to preserve and improve the X11 https://redd.it/1x6v65a…
  5. Oct 18, 2026PSA: "Beginner" distros aren't just for beginners. These days it's not quite as rampant as…
  6. Oct 18, 2026I made a tool to use OpenCore as a macOS like bootloader on Linux https://redd.it/1x8ykrm…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →