What makes a CLI tool "pipeline-friendly"?
IntermediateConceptOS, filesystem, subprocess & CLIs
Answer
- Data on stdout, logs and progress on stderr.
- Meaningful exit codes: 0 ok, 1 error, 2 usage or "findings found" (documented).
- Machine-readable output option (
--format json) alongside human output. - Non-interactive by default: no prompts when stdin is not a TTY;
--yesto confirm. - Configuration via flags and env vars, no hidden state files.
--dry-runfor anything destructive, idempotent when re-run.- No colors when output is not a TTY (
NO_COLORrespected).
More on OS, filesystem, subprocess & CLIs
`os.path` vs `pathlib`: which do you use and why?BeginnerHow do you read environment variables safely?BeginnerHow do you walk a directory tree and find files?BeginnerWhat does `shutil` give you that `os` does not?BeginnerHow do you run an external command correctly with `subprocess`?BeginnerWhy is `shell=True` dangerous, and when is it acceptable?Intermediate