Topic: cli
-
Designing a Python command-line tool: argparse, main() and exit codes
Put the interface in a main(argv) -> int function registered as a console script, validate with argparse type and choices, follow the exit-code convention (0 success, 2 usage error, 1 other failure, sysexits codes only if documented), keep results on stdout and diagnostics on stderr, and handle SIGINT and broken pipes.
Machine-readable: JSON