Let's Make Better Command Line Applications
summary
Practical checklist for better CLIs: use Python but favor real parsers — click + Colorama for sane defaults, docopt if you prefer spec-first, and argparse only when you can't add deps; export a console_scripts entry point, use a shebang with env, handle stdin/stdout/stderr (support dash for stdin/stdout), emit zero/nonzero exit codes, cascade defaults ← config ← env ← CLI, disable colors when not a terminal. Example: a character-counter reads stdin or file, writes results to stdout, logs to stderr or file, and behaves as expected.
AI-written summary · about
chapters (30)
- 0:00Intro
- 1:22POSIX Standard
- 2:37Redirection
- 4:55Why Command Line
- 5:24Why Python
- 6:27Shell Scripts
- 7:19Command Line Applications
- 8:35Status Codes
- 9:22Configuration
- 11:01Colors
- 11:36Parsers
- 12:39Shebang Line
- 14:20Package
- 15:00Entry Points
- 16:24Purse
- 16:38Hello World
- 18:06clique
- 18:29decorators
- 18:55decorator click
- 19:55command line
- 22:10run
- 22:55example program
- 23:13new commandline module
- 25:10echo
- 27:42verbose
- 28:35Extras
- 28:49Cookie Cutter
- 29:31Logging
- 30:05Summary
- 30:23Questions
related talks
27mHow to Write a Great Command Line Application
29mBuilding Nice Command Line Interfaces — A Look Beyond the stdlib
16mBuilding an interactive CLI app in Elixir
25mThe Hitchhiker's Guide to CLIs in Python
25mReinventing the CLI with Go
36mCLI applications & TDD: Never write scripts again
16mHow Not To Build Your CLI’s
33mUpgrading Python CLIs From Scripts to Interactive Tools
