Sha256: 72489c667d371c4931c5b91b68ff737deff62e5fe2ae5eabd0b32c4afa257a4f

Contents?: true

Size: 632 Bytes

Versions: 2

Compression:

Stored size: 632 Bytes

Contents

#!/usr/bin/env ruby
# frozen_string_literal: true

require 'rack'
require 'pry'
require 'rash/shell'

ENV['RACK_ENV'] ||= 'development'
config_ru_path = ENV.fetch('CONFIG_RU_PATH', 'config.ru')
Rack::Builder.parse_file(config_ru_path)

cmd = ''

if !$stdin.tty? || ARGV.any?
  Pry.prompt = Pry::Prompt[:none][:value]
  Pry.hooks.delete_hook(:before_session, :welcome)
  Pry.config.print = proc { |output, value| output.puts value }

  input = ARGV.any? ? ARGV.join(' ') : $stdin.read
  cmd = 'begin;' + input + ';rescue=>e;$stderr.puts(e.message);abort;else(exit);end'
end

Pry.start(Pry.toplevel_binding, input: StringIO.new(cmd))

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rash-shell-0.3.1 bin/rash
rash-shell-0.3.0 bin/rash