Sha256: 0ac1a7bbd2029b97d558669d390cb5e67bb297e62c9c0e1cc1de0505cd550479

Contents?: true

Size: 845 Bytes

Versions: 6

Compression:

Stored size: 845 Bytes

Contents

# frozen_string_literal: true

require "byebug/command"

module Byebug
  #
  # Execute a file containing byebug commands.
  #
  # It can be used to restore a previously saved debugging session.
  #
  class SourceCommand < Command
    self.allow_in_control = true
    self.allow_in_post_mortem = true

    def self.regexp
      /^\s* so(?:urce)? (?:\s+(\S+))? \s*$/x
    end

    def self.description
      <<-DESCRIPTION
        source <file>

        #{short_description}
      DESCRIPTION
    end

    def self.short_description
      "Restores a previously saved byebug session"
    end

    def execute
      return puts(help) unless @match[1]

      file = File.expand_path(@match[1]).strip
      return errmsg(pr("source.errors.not_found", file: file)) unless File.exist?(file)

      processor.interface.read_file(file)
    end
  end
end

Version data entries

6 entries across 6 versions & 4 rubygems

Version Path
talon_one-2.0.0 vendor/bundle/ruby/2.3.0/gems/byebug-11.0.1/lib/byebug/commands/source.rb
honeybadger-4.5.3 vendor/bundle/ruby/2.6.0/gems/byebug-11.0.1/lib/byebug/commands/source.rb
chatops-rpc-0.0.2 fixtures/chatops-controller-example/vendor/bundle/ruby/2.5.0/gems/byebug-11.0.1/lib/byebug/commands/source.rb
chatops-rpc-0.0.1 fixtures/chatops-controller-example/vendor/bundle/ruby/2.5.0/gems/byebug-11.0.1/lib/byebug/commands/source.rb
byebug-11.0.1 lib/byebug/commands/source.rb
byebug-11.0.0 lib/byebug/commands/source.rb