Sha256: 1fb22d799011a24c8a380d1f11c16956bc20fe97c77ee2da6489e25648118dc2

Contents?: true

Size: 622 Bytes

Versions: 1

Compression:

Stored size: 622 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;puts(e.message);abort;else(exit);end'
end

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rash-shell-0.2.0 bin/rash