Class: MGit::HelpCommand

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

Instance Method Summary collapse

Methods inherited from Command

execute, instance_each, list, register_alias, register_command

Methods included from Output

#perror, #pinfo, #ptable, #pwarn

Instance Method Details

#arityObject



16
17
18
# File 'lib/mgit/commands/help.rb', line 16

def arity
  [0, 1]
end

#descriptionObject



24
25
26
# File 'lib/mgit/commands/help.rb', line 24

def description
  'display help information'
end

#execute(args) ⇒ Object



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

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

#usageObject



20
21
22
# File 'lib/mgit/commands/help.rb', line 20

def usage
  'help [command]'
end