Skip to content
davetron5000 edited this page Jul 27, 2012 · 2 revisions

RDoc your Application

All gli-based applications include a "hidden" command named _doc (was rdoc in GLI 1.x). When you execute this command, by default, a file called yourapp.rdoc is created in the current directory. This contains an rdoc-formatted helpfile for your command line application. This can be useful in packaging your application to share with others. This is also the only place in which the long_desc values of the switches and flags are currently used.

If your application has a README.rdoc already, you can simply add :include:yourapp.rdoc to the bottom and it will be included when you generate and publish your rdoc (note that it will not show up on github).

Other documentation formats

The _doc command accepts a flag, --format. By default, the value is rdoc, which uses the built-in RDoc format. You can provide your own by providing the name of a class that is available to your application. This class should implement the methods outlined in GLI::Commands::Doc::DocumentListener to generate whatever documentation you want from the app. You should get access to all the commands, flags, switches, and documentation for your app via a series of callbacks.