Documenting a Command Suite
Since command suites like todo are more complex than simpler
command-line apps like db_backup.rb, it’s important that we have
documentation and that it’s easy to access. Users need to know not only what each option
does and what the arguments mean but also what commands are available and what they do.
The best way to provide this information is via a two-level help system.
At the top “level,” we see the “banner”-type information, the global options,
the list of commands, and what each command does. This information should be provided
when the app is invoked with no arguments or when invoked with the command
help
, like so:
| $ bin/todo help |
| NAME |
| todo - |
| |
| SYNOPSIS |
| todo [global options] command [command ... |
Get Build Awesome Command-Line Applications in Ruby 2 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.