Class: MGit::ListCommand

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

Instance Method Summary collapse

Methods inherited from Command

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

Instance Method Details

#descriptionObject



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

def description
  'list all repositories'
end

#execute(args) ⇒ Object



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

def execute(args)
  raise TooManyArgumentsError.new(self) if args.size != 0

  Registry.each do |repo|
    nc = 24
    display = (repo.name.size > nc) ? (repo.name[0..(nc - 3)] + '...') : repo.name.ljust(nc, ' ')
    puts "#{display} => #{repo.path}"
  end
end

#usageObject



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

def usage
  'list'
end