Sha256: 9d0755cd6f70469a932aa279797c57c7bd0f8e901f18457d091b916d0bbfca6c

Contents?: true

Size: 729 Bytes

Versions: 19

Compression:

Stored size: 729 Bytes

Contents

# frozen_string_literal: true

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

module Rfix::Cmd
  include Rfix::Log

  def cmd(*args, quiet: false)
    out, err, status = Open3.capture3(*args)
    box = Rfix::Box.new(out, err, status, args, quiet)
    return box.stdout if box.success?
    return yield if block_given?
    return if quiet

    box.render(color: :red)
    exit box.exit_status
  ensure
    # box.render(debug: false)
  end

  def cmd_succeeded?(*cmd)
    Open3.capture2e(*cmd).last.success?
  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

19 entries across 19 versions & 1 rubygems

Version Path
rfix-1.4.1 lib/rfix/cmd.rb
rfix-1.4.0.pre.201 lib/rfix/cmd.rb
rfix-1.4.0 lib/rfix/cmd.rb
rfix-1.3.0.pre.199 lib/rfix/cmd.rb
rfix-1.2.6.pre.198 lib/rfix/cmd.rb
rfix-1.2.6 lib/rfix/cmd.rb
rfix-1.2.2.pre.174 lib/rfix/cmd.rb
rfix-1.2.5 lib/rfix/cmd.rb
rfix-1.2.4 lib/rfix/cmd.rb
rfix-1.2.3.pre lib/rfix/cmd.rb
rfix-1.2.2.pre lib/rfix/cmd.rb
rfix-1.2.2.pre.172 lib/rfix/cmd.rb
rfix-1.2.2 lib/rfix/cmd.rb
rfix-1.1.0.pre.150 lib/rfix/cmd.rb
rfix-1.2.0 lib/rfix/cmd.rb
rfix-1.1.4.pre lib/rfix/cmd.rb
rfix-1.1.1.pre lib/rfix/cmd.rb
rfix-1.1.0.pre.149 lib/rfix/cmd.rb
rfix-1.1.0.pre.147 lib/rfix/cmd.rb