Method: MGit::ForEachCommand#execute

Defined in:
lib/mgit/commands/foreach.rb

#execute(args) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/mgit/commands/foreach.rb', line 3

def execute(args)
  command = args.join(' ')

  Registry.each do |repo|
    pinfo "Executing command in repository #{repo.name}..."

    sc = System.run(command, chdir: repo.path, print_stdout: true, print_stderr: true)
    next if sc.success?

    unless agree("Executing command '#{command}' in repository '#{repo.name}' failed. Would you like to continue anyway?".red)
      break
    end
  end
end