Class: Cmd::Add::Repl

Inherits:
Dry::CLI::Command
  • Object
show all
Extended by:
T::Sig
Includes:
Dry::Monads
Defined in:
lib/cmd/add/repl.rb

Defined Under Namespace

Classes: ConfigType

Constant Summary collapse

IRB_TEMPLATE =
<<~CONTENT
  #!/usr/bin/env ruby

  # frozen_string_literal: true

  require 'irb'
  IRB.start
CONTENT
PRY_TEMPLATE =
<<~CONTENT
  #!/usr/bin/env ruby

  require 'pry-reload'
  require 'pry'
  Pry.start
CONTENT

Instance Method Summary collapse

Instance Method Details

#call(irb:, pry:) ⇒ Object



44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/cmd/add/repl.rb', line 44

def call(irb:, pry:)
  if pry
    response = install_deps

    if response.failure?
      # TODO: make this better with red message maybe.
      puts response.failure[:message]
      return
    end
  end

  write_config(type: ConfigType::IRB) if irb
  write_config(type: ConfigType::PRY) if pry
end