Sha256: 6e884fdd49d6c0e3aaf56b880614df17f1edabd044c1edc5e593a82b21aac553

Contents?: true

Size: 683 Bytes

Versions: 6

Compression:

Stored size: 683 Bytes

Contents

# frozen_string_literal: true

require "open3"
require "rfix"
require "rfix/log"

module Rfix::Cmd
  include Rfix::Log

  def cmd(*args)
    out, err, status = Open3.capture3(*args)

    unless status.success?
      return yield if block_given?

      say_error "[Cmd] {{italic:#{args.join(" ")}}}"
      say_error "[Pwd] {{italic:#{Dir.pwd}}}"
      say_error "[Err] {{error:#{err.strip}}}"
      
      exit status.exitstatus
    end

    out.lines.map(&:chomp)
  end

  def params
    [
      "--word-diff-regex=[^[:space:]]",
      "--no-renames",
      "--no-merges",
      "--first-parent",
      "--diff-filter=AM",
      "-U0",
      "--no-color",
      "-p"
    ]
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rfix-1.0.5 lib/rfix/cmd.rb
rfix-1.0.4 lib/rfix/cmd.rb
rfix-1.0.3 lib/rfix/cmd.rb
rfix-1.0.2 lib/rfix/cmd.rb
rfix-1.0.1 lib/rfix/cmd.rb
rfix-1.0.0 lib/rfix/cmd.rb