# usage.rb

Path: | rdoc/usage.rb
Last Update: | Sat Oct 15 23:44:29 AUS Eastern Standard Time 2005

# Synopsis

This library allows command-line tools to encapsulate their usage as a comment at the top of the main file. Calling `RDoc::usage` then displays some or all of that comment, and optionally exits the program with an exit status. We always look for the comment in the main program file, so it is safe to call this method from anywhere in the executing program.

# Usage

      RDoc::usage( [ exit_status ], [ section, ...])
      RDoc::usage_no_exit( [ section, ...])

where:

exit_status: | the integer exit code (default zero). RDoc::usage will exit the calling program with this status.
section: | an optional list of section names. If specified, only the sections with the given names as headings will be output. For example, this section is named ‘Usage’, and the next section is named ‘Examples’. The section names are case insensitive.

# Examples

       # Comment block describing usage
       # with (optional) section headings
       # . . .

       require 'rdoc/usage'

       # Display all usage and exit with a status of 0

       RDoc::usage

       # Display all usage and exit with a status of 99

       RDoc::usage(99)

       # Display usage in the 'Summary' section only, then
       # exit with a status of 99

       RDoc::usage(99, 'Summary')

       # Display information in the Author and Copyright
       # sections, then exit 0.

       RDoc::usage('Author', 'Copyright')

       # Display information in the Author and Copyright
       # sections, but don't exit

       RDoc::usage_no_exit('Author', 'Copyright')

# Author

Dave Thomas, The Pragmatic Programmers, LLC

# Copyright

Copyright © 2004 Dave Thomas. Licensed under the same terms as Ruby

### Required files

rdoc/markup/simple_markup rdoc/markup/simple_markup/to_flow rdoc/ri/ri_formatter rdoc/ri/ri_options

[Validate]