Class: GLI::Commands::Doc
- Inherits:
-
GLI::Command
- Object
- GLI::CommandLineToken
- GLI::Command
- GLI::Commands::Doc
- Defined in:
- lib/gli/commands/doc.rb
Overview
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
Defined Under Namespace
Classes: DocumentListener
Constant Summary collapse
- FORMATS =
{ 'rdoc' => GLI::Commands::RdocDocumentListener, }
Instance Attribute Summary
Attributes included from GLI::CommandSupport
Attributes inherited from GLI::CommandLineToken
#aliases, #description, #long_description, #name
Instance Method Summary collapse
-
#document(document_listener) ⇒ Object
Generates documentation using the listener.
-
#initialize(app) ⇒ Doc
constructor
Create the Doc generator based on the GLI app passed in.
- #nodoc ⇒ Object
Methods inherited from GLI::Command
#action, #default_command, #default_desc, #has_option?, name_as_string
Methods included from GLI::CommandSupport
#arg_name, #arguments_description, #arguments_options, #commands, #commands_declaration_order, #context_description, #default_description, #default_value, #desc, #execute, #flag, #flags, #get_default_command, #has_action?, #long_desc, #names, #skips_around, #skips_post, #skips_pre, #switch, #switches, #topmost_ancestor, #usage
Methods included from DSL
#arg_name, #clear_nexts, #command, #default_value, #desc, #flag, #long_desc, #switch
Methods included from GLI::CopyOptionsToAliases
Methods inherited from GLI::CommandLineToken
Constructor Details
#initialize(app) ⇒ Doc
Create the Doc generator based on the GLI app passed in
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# 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 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 |,,arguments| self.document(format_class([:format]).new(,,arguments)) end end |
Instance Method Details
#document(document_listener) ⇒ Object
Generates documentation using the listener
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/gli/commands/doc.rb', line 33 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 (@app) document_listener. end document_flags_and_switches(document_listener, @app.flags.values.sort(&by_name), @app.switches.values.sort(&by_name)) if (@app) document_listener. end document_listener.commands document_commands(document_listener,@app) document_listener.end_commands document_listener.ending end |
#nodoc ⇒ Object
28 29 30 |
# File 'lib/gli/commands/doc.rb', line 28 def nodoc true end |