Documenting a Command-Line Interface
An experienced command-line user will try one or two things on the command line to
discover how to use an app: they will run it without arguments or
give it a help switch, such as -h or
--help (-help is also
a possibility because many X-Windows apps respond to this for help). In each case,
the user will expect to see a one-screen summary of
the app’s usage, including what arguments
the app accepts or requires and what options are available.
Because db_backup.rb uses OptionParser, we’re most of the way there already. Apps that use OptionParser respond to -h and --help in just the way our users expect. When OptionParser encounters either of these switches on the command line (assuming you haven’t overridden ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access