Class: MGit::CheckoutCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/mgit/commands/checkout.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

[View source]

13
14
15
# File 'lib/mgit/commands/checkout.rb', line 13

def arity
  [1, 1]
end

#descriptionObject

[View source]

21
22
23
# File 'lib/mgit/commands/checkout.rb', line 21

def description
  'checkout commit object in all repositories that have it'
end

#execute(args) ⇒ Object

[View source]

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

def execute(args)
  @commit = args.shift

  if repos.empty?
    perror "Couldn't find commit #{@commit} in any repository."
  else
    checkout_all
  end
end

#usageObject

[View source]

17
18
19
# File 'lib/mgit/commands/checkout.rb', line 17

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