lib/git/multi.rb in git-multi-2.6.1 vs lib/git/multi.rb in git-multi-2.7.0
- old
+ new
@@ -2,18 +2,19 @@
require 'json'
require 'pathname'
require 'fileutils'
require 'shellwords'
+require 'English'
+
require 'octokit'
require 'sawyer'
require 'faraday'
require 'addressable'
require 'ext/dir'
require 'ext/string'
-require 'ext/kernel'
require 'ext/commify'
require 'ext/sawyer/resource'
require 'git/hub'
@@ -142,24 +143,37 @@
# the main `Git::Multi` capabilities
#
module Nike
- def just_do_it(interactive, pipeline, options = {})
+ # rubocop:disable Metrics/PerceivedComplexity
+ # rubocop:disable Metrics/CyclomaticComplexity
+ def just_do_it(interactive, pipelined, captured = nil, options = {})
working_dir = case (options[:in] || '').to_sym
when :parent_dir then parent_dir
when :local_path then local_path
else Dir.pwd
end
Dir.chdir(working_dir) do
- if interactive?
- puts "#{full_name.invert} (#{fractional_index})"
+ if STDOUT.tty? && STDERR.tty?
+ STDOUT.puts "#{full_name.invert} (#{fractional_index})"
interactive.call(self)
+ elsif STDERR.tty?
+ errors = File.join(ENV['TMPDIR'], "git-multi.#{$PID}")
+ captured.call(self, errors)
+ unless File.zero?(errors)
+ # rubocop:disable Style/StderrPuts
+ STDERR.puts "#{full_name.invert} (#{fractional_index})"
+ Kernel.system "cat #{errors} > /dev/tty ;"
+ # rubocop:enable Style/StderrPuts
+ end
else
- pipeline.call(self)
+ pipelined.call(self)
end
end
end
+ # rubocop:enable Metrics/CyclomaticComplexity
+ # rubocop:enable Metrics/PerceivedComplexity
def spputs(*args)
# split, prefix and puts
args.each do |arg|
case arg