Sha256: 9915e4468799e8ed7f07b4d43a260e50ec0d77aa2fa5ef3fc1a52f0b38fb0623

Contents?: true

Size: 813 Bytes

Versions: 15

Compression:

Stored size: 813 Bytes

Contents

# frozen_string_literal: true

require "irb"
require "irb/completion"

module Jets::Command
  class ConsoleCommand < Base # :nodoc:
    include EnvironmentArgument

    desc "console", "REPL console with Jets environment loaded"
    long_desc Help.text(:console)
    def perform
      extract_environment_option_from_argument
      require_application_and_environment!
      Console.new(options).run
    end
  end

  class Console
    attr_reader :environment

    def initialize(environment)
      @environment = environment
    end

    def run
      puts Jets::Booter.message

      # Thanks: https://mutelight.org/bin-console
      require "irb"
      require "irb/completion"

      ARGV.clear # https://stackoverflow.com/questions/33070092/irb-start-not-starting/33136762
      IRB.start
    end
  end

end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
jets-5.0.13 lib/jets/commands/console/console_command.rb
jets-5.0.12 lib/jets/commands/console/console_command.rb
jets-5.0.11 lib/jets/commands/console/console_command.rb
jets-5.0.10 lib/jets/commands/console/console_command.rb
jets-5.0.9 lib/jets/commands/console/console_command.rb
jets-5.0.8 lib/jets/commands/console/console_command.rb
jets-5.0.7 lib/jets/commands/console/console_command.rb
jets-5.0.6 lib/jets/commands/console/console_command.rb
jets-5.0.5 lib/jets/commands/console/console_command.rb
jets-5.0.4 lib/jets/commands/console/console_command.rb
jets-5.0.3 lib/jets/commands/console/console_command.rb
jets-5.0.2 lib/jets/commands/console/console_command.rb
jets-5.0.1 lib/jets/commands/console/console_command.rb
jets-5.0.0 lib/jets/commands/console/console_command.rb
jets-5.0.0.beta1 lib/jets/commands/console/console_command.rb