Class: MGit::ForEachCommand
Instance Method Summary
collapse
Methods inherited from Command
execute, instance_each, list, register_alias, register_command
Methods included from Output
#perror, #pinfo, #ptable, #pwarn
Instance Method Details
#arity ⇒ Object
14
15
16
|
# File 'lib/mgit/commands/foreach.rb', line 14
def arity
[1, nil]
end
|
#description ⇒ Object
22
23
24
|
# File 'lib/mgit/commands/foreach.rb', line 22
def description
'execute a command for each repository'
end
|
#execute(args) ⇒ Object
3
4
5
6
7
8
9
10
11
12
|
# File 'lib/mgit/commands/foreach.rb', line 3
def execute(args)
command = args.join(' ')
Registry.chdir_each do |repo|
pinfo "Executing command in repository #{repo.name}..."
if !system(command) && !ask("Executing command '#{command}' in repository '#{repo.name}' failed. Would you like to continue anyway?".red)
break
end
end
end
|
#usage ⇒ Object
18
19
20
|
# File 'lib/mgit/commands/foreach.rb', line 18
def usage
'foreach <command...>'
end
|