Sha256: b67440b7ecf4b0fa58a14f607fcf775d8279ea33e5f44613d086de249bbd09d1

Contents?: true

Size: 607 Bytes

Versions: 23

Compression:

Stored size: 607 Bytes

Contents

#!/usr/bin/env ruby
require 'tempfile'
require 'readline'
include Readline

$:.unshift '.', '..', 'lib', File.join('..','lib')
require 'session'

shell = Session::Shell.new

require 'tempfile'
require 'readline'
include Readline

n = 0
loop do
  command = readline("#{ n }: SHELL > ", true) 
  if command =~ /^\s*\!*history\!*\s*$/
    open('shell.history','w'){|f| f.puts shell.history}
    next
  end
  exit if command =~ /^\s*(?:exit|quit)\s*$/io

  out, err = shell.execute command
  out ||= ''
  err ||= ''
  printf "STDOUT:\n%s\nSTDERR:\n%s\n", out.gsub(%r/^/,"\t"), err.gsub(%r/^/,"\t")
  n += 1
end

Version data entries

23 entries across 23 versions & 2 rubygems

Version Path
redcar-0.3.8.1 plugins/runnables/vendor/session-2.4.0/sample/session_sh.rb
redcar-0.3.8 plugins/runnables/vendor/session-2.4.0/sample/session_sh.rb
session-3.1.0 sample/session_sh.rb