Class: MGit::ForEachCommand
Instance Method Summary
collapse
Methods inherited from Command
create, #help, instance_each, list, register_alias, register_command
Instance Method Details
#description ⇒ Object
20
21
22
|
# File 'lib/mgit/commands/foreach.rb', line 20
def description
'execute a command for each repository'
end
|
#execute(args) ⇒ Object
3
4
5
6
7
8
9
10
11
12
13
14
|
# File 'lib/mgit/commands/foreach.rb', line 3
def execute(args)
raise TooFewArgumentsError.new(self) if args.size == 0
command = args.join(' ')
Repository.chdir_each do |name, path|
puts "Executing command in repository #{name}...".yellow
if !system(command) && !ask("Executing command '#{command}' in repository '#{name}' failed. Would you like to continue anyway?".red)
break
end
end
end
|
#usage ⇒ Object
16
17
18
|
# File 'lib/mgit/commands/foreach.rb', line 16
def usage
'foreach <command...>'
end
|