class Shred::Commands::ShellCommandRunner

Attributes

console[R]

Public Class Methods

new(console:) click to toggle source
# File lib/shred/commands/base.rb, line 94
def initialize(console:)
  @console = console
end

Public Instance Methods

run(shell_command) click to toggle source
# File lib/shred/commands/base.rb, line 98
def run(shell_command)
  exit_status = shell_command.run do |command_line|
    console.say_trace(command_line)
    command_line.run
  end
  if exit_status.success?
    if shell_command.success_msg
      console.say_ok(shell_command.success_msg)
    end
  elsif
    if shell_command.error_msg
      console.say_err("#{shell_command.error_msg}: #{exit_status}")
    else
      console.say_err(exit_status)
    end
  end
  exit_status
end