Class: GitFlow::HelpCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/git_bpf/lib/gitflow.rb

Instance Method Summary collapse

Instance Method Details

#execute(opts, argv) ⇒ Object



275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
# File 'lib/git_bpf/lib/gitflow.rb', line 275

def execute(opts, argv)
  if argv.empty?
    opt = GitFlow.optparse
    opt.banner = "Usage: #{GitFlow.program} command [options]"
    opt.separator ' '
    opt.separator 'COMMANDS'
    opt.separator ' '
    commands = GitFlow.commands.map { |name, cls| [nil, name, cls.help] }.
      sort_by { |a| a[1] || '' }
    commands.each { |a| opt.separator("%-2s%-25s%s" % a) if a[1] }
    opt.separator ' '
    opt.separator 'You can also obtain help for any command giving it --help.'
    page { puts opt }
  else
    run(*(argv + ['--help']))
  end
end