class MGit::ForEachCommand
Public Instance Methods
arity()
click to toggle source
# File lib/mgit/commands/foreach.rb, line 18 def arity [1, nil] end
description()
click to toggle source
# File lib/mgit/commands/foreach.rb, line 26 def description 'execute a command for each repository' end
execute(args)
click to toggle source
# 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
usage()
click to toggle source
# File lib/mgit/commands/foreach.rb, line 22 def usage 'foreach <command...>' end