Takes a DocListener which will be called with all of the meta-data and documentation about your app, so as to create documentation in whatever format you want
Namespace
Methods
Constants
FORMATS | = | { 'rdoc' => GLI::Commands::RdocDocumentListener } |
Class Public methods
new(app)
Link
Source: show
# File lib/gli/commands/doc.rb, line 10 def initialize(app) super(:names => "_doc", :description => "Generate documentation of your application's UI", :long_desc => "Introspects your application's UI meta-data to generate documentation in a variety of formats. This is intended to be extensible via the DocumentListener interface, so that you can provide your own documentation formats without them being a part of GLI", :skips_pre => true, :skips_post => true, :skips_around => true, :hidden => true) @app = app @parent = @app @subcommand_option_handling_strategy = @app.subcommand_option_handling_strategy desc 'The format name of the documentation to generate or the class name to use to generate it' default_value 'rdoc' arg_name 'name_or_class' flag :format action do |global_options,options,arguments| self.document(format_class(options[:format]).new(global_options,options,arguments,app)) end end
Instance Public methods
document(document_listener)
Link
Generates documentation using the listener
Source: show
# File lib/gli/commands/doc.rb, line 35 def document(document_listener) document_listener.beginning document_listener.program_desc(@app.program_desc) unless @app.program_desc.nil? document_listener.program_long_desc(@app.program_long_desc) unless @app.program_long_desc.nil? document_listener.version(@app.version_string) if any_options?(@app) document_listener.options end document_flags_and_switches(document_listener, @app.flags.values.sort(&by_name), @app.switches.values.sort(&by_name)) if any_options?(@app) document_listener.end_options end document_listener.commands document_commands(document_listener,@app) document_listener.end_commands document_listener.ending end