Sha256: d4cb2c3adbd67b0695a204e648317d834e9195436b17d31ce6c09bc63c39bdfb

Contents?: true

Size: 852 Bytes

Versions: 13

Compression:

Stored size: 852 Bytes

Contents

# frozen_string_literal: true

require "irb"
require_relative "core"

module Hanami
  module CLI
    module Repl
      # @since 2.0.0
      # @api private
      class Irb < Core
        # @since 2.0.0
        # @api private
        def start
          $stdout.sync = true

          ARGV.shift until ARGV.empty?
          TOPLEVEL_BINDING.eval("self").extend(context)

          # Initializes the IRB.conf; our own conf changes must be after this
          IRB.setup(nil)

          IRB.conf[:PROMPT][:HANAMI] = {
            AUTO_INDENT: true,
            PROMPT_I: "#{prompt}> ",
            PROMPT_N: "#{prompt}> ",
            PROMPT_S: "#{prompt} %l> ",
            PROMPT_C: "#{prompt} ?> ",
            RETURN: "=> %s\n"
          }

          IRB.conf[:PROMPT_MODE] = :HANAMI

          IRB::Irb.new.run
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
hanami-cli-2.2.0.beta2 lib/hanami/cli/repl/irb.rb
hanami-cli-2.2.0.beta1 lib/hanami/cli/repl/irb.rb
hanami-cli-2.1.1 lib/hanami/cli/repl/irb.rb
hanami-cli-2.1.0 lib/hanami/cli/repl/irb.rb
hanami-cli-2.1.0.rc3 lib/hanami/cli/repl/irb.rb
hanami-cli-2.1.0.rc2 lib/hanami/cli/repl/irb.rb
hanami-cli-2.1.0.rc1 lib/hanami/cli/repl/irb.rb
hanami-cli-2.1.0.beta2 lib/hanami/cli/repl/irb.rb
hanami-cli-2.1.0.beta1 lib/hanami/cli/repl/irb.rb
hanami-cli-2.0.3 lib/hanami/cli/repl/irb.rb
hanami-cli-2.0.2 lib/hanami/cli/repl/irb.rb
hanami-cli-2.0.1 lib/hanami/cli/repl/irb.rb
hanami-cli-2.0.0 lib/hanami/cli/repl/irb.rb