class Byebug::PryCommand

Implements byebug’s “pry” command

def description

def description
  %{
    pry[ -d]\tstarts a Pry session.
  }
end

def execute

def execute
  unless @state.interface.kind_of?(LocalInterface)
    print "Command is available only in local mode.\n"
    throw :debug_error
  end
  add_debugging = @match.is_a?(MatchData) && '-d' == @match[1]
  $byebug_state = @state if add_debugging
  get_binding.pry
  $byebug_state = nil if add_debugging
end

def names

def names
  %w(pry)
end

def regexp

def regexp
  /^\s* pry
    (?:\s+(-d))?
    \s*$/x
end