Sha256: 1951789a74639c4357c6d4bdd8186d87c092124bc8307adb7611274503109691

Contents?: true

Size: 1.08 KB

Versions: 2

Compression:

Stored size: 1.08 KB

Contents

require_relative "shelltastic/version"
require_relative "shelltastic/utils"
require_relative "shelltastic/output_formatter"
require_relative "shelltastic/command_io"
require_relative "shelltastic/timer"
require_relative "shelltastic/exceptions"

# ShellTastic namespace
module ShellTastic
  class Command
    class << self
      # run is the entry point to api 
      # @param command [String] command or multiple commands to be executed
      # @param command [Array] multiple commands to be executed
      # @param timer [Object] timer object, @see ShellTastic::Timer
      # @return [Array] Array of hashes for each command executed @see IO::popen
      # @example
      #   ShellTastic::Command.run "whoami"
      #   ShellTastic::Command.run "whoami", "date"
      def run(*command)
        command.flatten.map { |cmd| ShellTastic::IO.popen(cmd, ShellTastic::Timer.new, ShellTastic::OutputFormatter.new) }
      end

      def start(*command)
        command.flatten.map { |cmd| ShellTastic::IO.fire_and_forget(cmd, ShellTastic::Timer.new, ShellTastic::OutputFormatter.new) }
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
shelltastic-1.0.0 lib/shelltastic.rb
shelltastic-0.5.0 lib/shelltastic.rb