Methods
B
C
D
E
F
N
O
P
S
V
Class Public methods
new(global_options,options,arguments,app)
# File lib/gli/commands/rdoc_document_listener.rb, line 7
def initialize(global_options,options,arguments,app)
  @app = app
  @io = File.new("#{app.exe_name}.rdoc",'w')
  @nest = ''
  @arg_name_formatter = GLI::Commands::HelpModules::ArgNameFormatter.new
end
Instance Public methods
beginning()
# File lib/gli/commands/rdoc_document_listener.rb, line 14
def beginning
end
command(name,aliases,desc,long_desc,arg_name,arg_options)

Gives you a command in the current context and creates a new context of this command

# File lib/gli/commands/rdoc_document_listener.rb, line 84
def command(name,aliases,desc,long_desc,arg_name,arg_options)
  @io.puts "#{@nest}=== Command: <tt>#{([name] + aliases).join('|')} #{@arg_name_formatter.format(arg_name,arg_options,[])}</tt>"
  @io.puts String(desc).strip
  @io.puts 
  @io.puts String(long_desc).strip
  @nest = "#{@nest}="
end
commands()
# File lib/gli/commands/rdoc_document_listener.rb, line 78
def commands
  @io.puts "#{@nest}=== Commands"
  @nest = "#{@nest}="
end
default_command(name)

Gives you the name of the current command in the current context

# File lib/gli/commands/rdoc_document_listener.rb, line 98
def default_command(name)
  @io.puts "[Default Command] #{name}" unless name.nil?
end
end_command(name)

Ends a command, and “pops” you back up one context

# File lib/gli/commands/rdoc_document_listener.rb, line 93
def end_command(name)
  @nest.gsub!(/=$/,'')
end
end_commands()
# File lib/gli/commands/rdoc_document_listener.rb, line 102
def end_commands
  @nest.gsub!(/=$/,'')
end
end_options()
# File lib/gli/commands/rdoc_document_listener.rb, line 75
def end_options
end
ending()

Called when processing has completed

# File lib/gli/commands/rdoc_document_listener.rb, line 18
def ending
  @io.close
end
flag(name,aliases,desc,long_desc,default_value,arg_name,must_match,type)

Gives you a flag in the current context

# File lib/gli/commands/rdoc_document_listener.rb, line 48
def flag(name,aliases,desc,long_desc,default_value,arg_name,must_match,type)
  invocations = ([name] + Array(aliases)).map { |_| add_dashes(_) }.join('|')
  usage = "#{invocations} #{arg_name || 'arg'}"
  @io.puts "#{@nest}=== #{usage}"
  @io.puts
  @io.puts String(desc).strip
  @io.puts
  @io.puts "[Default Value] #{default_value || 'None'}"
  @io.puts "[Must Match] #{must_match.to_s}" unless must_match.nil?
  @io.puts String(long_desc).strip
  @io.puts
end
options()
# File lib/gli/commands/rdoc_document_listener.rb, line 39
def options
  if @nest.size == 0
    @io.puts "=== Global Options"
  else
    @io.puts "#{@nest}=== Options"
  end
end
program_desc(desc)

Gives you the program description

# File lib/gli/commands/rdoc_document_listener.rb, line 23
def program_desc(desc)
  @io.puts "== #{@app.exe_name} - #{desc}"
  @io.puts
end
program_long_desc(desc)
# File lib/gli/commands/rdoc_document_listener.rb, line 28
def program_long_desc(desc)
  @io.puts desc
  @io.puts
end
switch(name,aliases,desc,long_desc,negatable)

Gives you a switch in the current context

# File lib/gli/commands/rdoc_document_listener.rb, line 62
def switch(name,aliases,desc,long_desc,negatable)
  if negatable
    name = "[no-]#{name}" if name.to_s.length > 1
    aliases = aliases.map { |_|  _.to_s.length > 1 ? "[no-]#{_}" : _ } 
  end
  invocations = ([name] + aliases).map { |_| add_dashes(_) }.join('|')
  @io.puts "#{@nest}=== #{invocations}"
  @io.puts String(desc).strip
  @io.puts
  @io.puts String(long_desc).strip
  @io.puts
end
version(version)

Gives you the program version

# File lib/gli/commands/rdoc_document_listener.rb, line 34
def version(version)
  @io.puts "v#{version}"
  @io.puts
end