Method: GLI::Commands::MarkdownDocumentListener#command

Defined in:
lib/hook/markdown_document_listener.rb

#command(name, aliases, desc, long_desc, arg_name, arg_options) ⇒ Object

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



118
119
120
121
122
123
124
125
126
127
128
129
# File 'lib/hook/markdown_document_listener.rb', line 118

def command(name, aliases, desc, long_desc, arg_name, arg_options)
  @parent_command.push ([name] + aliases).join('|')
  arg_name_fmt = @arg_name_formatter.format(arg_name, arg_options, [])
  arg_name_fmt = " `#{arg_name_fmt.strip}`" if arg_name_fmt
  @io.puts header("`$ #{@exe}` <mark>`#{@parent_command.join(' ')}`</mark>#{arg_name_fmt}", 1)
  @io.puts
  @io.puts "*#{String(desc).strip}*"
  @io.puts
  cmd_desc = String(long_desc).strip.split("\n").map { |_| "> #{_}" }.join("\n")
  @io.puts "#{cmd_desc}\n\n" unless cmd_desc.length == 0
  increment_nest
end