Class: ShellTastic::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/shelltastic.rb

Class Method Summary collapse

Class Method Details

.run(*command) ⇒ Array

run is the entry point to api

Examples:

ShellTastic::Command.run "whoami"
ShellTastic::Command.run "whoami", "date"

Parameters:

  • command (String)

    command or multiple commands to be executed

  • command (Array)

    multiple commands to be executed

  • timer (Object)

    timer object, @see ShellTastic::Timer

Returns:

  • (Array)

    Array of hashes for each command executed @see IO::popen



20
21
22
# File 'lib/shelltastic.rb', line 20

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