lib/gli/commands/doc.rb in gli-2.15.0 vs lib/gli/commands/doc.rb in gli-2.16.0
- old
+ new
@@ -2,11 +2,11 @@
module Commands
# 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
class Doc < Command
FORMATS = {
- 'rdoc' => GLI::Commands::RdocDocumentListener,
+ 'rdoc' => GLI::Commands::RdocDocumentListener
}
# Create the Doc generator based on the GLI app passed in
def initialize(app)
super(:names => "_doc",
:description => "Generate documentation of your application's UI",
@@ -137,11 +137,11 @@
end
private
def format_class(format_name)
- FORMATS.fetch(format_name) {
+ FORMATS.fetch(format_name) {
begin
return format_name.split(/::/).reduce(Kernel) { |context,part| context.const_get(part) }
rescue => ex
raise IndexError,"Couldn't find formatter or class named #{format_name}"
end
@@ -166,11 +166,17 @@
command_args = [command.name,
Array(command.aliases),
command.description,
command.long_description,
command.arguments_description]
- if document_listener.method(:command).arity == 6
+ if document_listener.method(:command).arity >= 6
command_args << command.arguments_options
+ if document_listener.method(:command).arity >= 7
+ command_args << command.arguments
+ end
+ if document_listener.method(:command).arity >= 8
+ command_args << command.examples
+ end
end
document_listener.command(*command_args)
end
def by_name