Class: MGit::BranchesCommand

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



12
13
14
# File 'lib/mgit/commands/branches.rb', line 12

def arity
  [nil, 0]
end

#descriptionObject



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

def description
  'list all repository branches and tracked upstream branches'
end

#execute(args) ⇒ Object



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

def execute(args)
  Registry.each do |repo|
    pinfo "Repository #{repo.name} contains branches:"
    repo.branches.each do |b|
      psystem "#{b[:name]} #{b[:current] ? '*' : ''}"
    end
  end
end

#usageObject



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

def usage
  'branches'
end