Sha256: 86db95d69542a313933ffaa552cc3a2e8f6dc4fd89560dbc1d09ad67147bd441

Contents?: true

Size: 722 Bytes

Versions: 12

Compression:

Stored size: 722 Bytes

Contents

module Cardio
  class Command
    # shared handling of commands splitting cardio and original args with "--"
    class CommandBase
      def run
        puts command
        exit_with_child_status command
      end

      def exit_with_child_status command
        command += " 2>&1"
        exit $CHILD_STATUS.exitstatus unless system command
      end

      # split special cardio args and original command args separated by '--'
      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
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
card-1.108.1 lib/cardio/command/command_base.rb
card-1.108.0 lib/cardio/command/command_base.rb
card-1.107.0 lib/cardio/command/command_base.rb
card-1.106.0 lib/cardio/command/command_base.rb
card-1.105.6 lib/cardio/command/command_base.rb
card-1.105.5 lib/cardio/command/command_base.rb
card-1.105.4 lib/cardio/command/command_base.rb
card-1.105.3 lib/cardio/command/command_base.rb
card-1.105.2.pre1 lib/cardio/command/command_base.rb
card-1.105.2 lib/cardio/command/command_base.rb
card-1.105.1 lib/cardio/command/command_base.rb
card-1.105.0 lib/cardio/command/command_base.rb