Class: MGit::HelpCommand

Inherits:
Command show all
Defined in:
lib/mgit/commands/help.rb

Instance Method Summary collapse

Methods inherited from Command

create, #help, instance_each, list, register_alias, register_command

Instance Method Details

#descriptionObject



22
23
24
# File 'lib/mgit/commands/help.rb', line 22

def description
  'display help information'
end

#execute(args) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/mgit/commands/help.rb', line 3

def execute(args)
  raise TooManyArgumentsError.new(self) if args.size > 1

  if args.size == 0
    puts "M[eta]Git - manage multiple git repositories at the same time"
    puts
    puts "Usage:"
    Command.instance_each do |cmd|
      puts "mgit #{cmd.usage}\n\t- #{cmd.description}"
    end
  else
    puts Command.create(args[0]).help
  end
end

#usageObject



18
19
20
# File 'lib/mgit/commands/help.rb', line 18

def usage
  'help [command]'
end