class GitFlow::HelpCommand

Public Instance Methods

execute(opts, argv) click to toggle source
# 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