Class: MGit::ShowCommand

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

Instance Method Summary collapse

Methods inherited from Command

#check_arity, create, execute, instance_each, list, load_commands, register_alias, register_command, require_commands_from_directory

Methods included from Output

#perror, #pinfo, #psystem, #ptable, #pwarn

Instance Method Details

#arityObject



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

def arity
  [1, 1]
end

#descriptionObject



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

def description
  'display commit object from any repository'
end

#execute(args) ⇒ Object



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

def execute(args)
  @commit = args.shift

  case repos.size
  when 0
    perror "Couldn't find commit #{@commit} in any repository."
  when 1
    show_commit(repos.first)
  else
    show_menu
  end
end

#usageObject



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

def usage
  'show <commit-sha/obj>'
end