class Cardio::Command::CommandBase

shared handling of commands splitting cardio and original args with “–”

Public Instance Methods

exit_with_child_status(command) click to toggle source
# File lib/cardio/command/command_base.rb, line 10
def exit_with_child_status command
  command += " 2>&1"
  exit $CHILD_STATUS.exitstatus unless system command
end
run() click to toggle source
# File lib/cardio/command/command_base.rb, line 5
def run
  puts command
  exit_with_child_status command
end
split_args(args) click to toggle source

split special cardio args and original command args separated by ‘–’

# File lib/cardio/command/command_base.rb, line 16
def split_args args
  before_split = true
  cardio_args, command_args =
    args.partition do |a|
      before_split = (a == "--" ? false : before_split)
    end
  command_args.shift
  [cardio_args, command_args]
end