Sha256: 4c734aa423477dc2c7e1f32862c097212d2b8458a7be17fdb72d92a405a65713
Contents?: true
Size: 1.13 KB
Versions: 3
Compression:
Stored size: 1.13 KB
Contents
module Byebug class Edit < Command self.allow_in_control = true def regexp /^\s* ed(?:it)? (?:\s+(.*))?$/ix end def execute if not @match[1] unless @state.context errmsg "We are not in a state that has an associated file.\n" return end file = @state.file line_number = @state.line elsif @pos_match = /([^:]+)[:]([0-9]+)/.match(@match[1]) file, line_number = @pos_match.captures else errmsg "Invalid file/line number specification: #{@match[1]}\n" return end editor = ENV['EDITOR'] || 'ex' if File.readable?(file) system("#{editor} +#{line_number} #{file}") else errmsg "File \"#{file}\" is not readable.\n" end end class << self def names %w(edit) end def description %{ edit[ file:lineno]\tEdit specified file. With no argument, edits file containing most recent line listed. Editing targets can also be specified to start editing at a specific line in a specific file. } end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
byebug-1.4.1 | lib/byebug/commands/edit.rb |
byebug-1.4.0 | lib/byebug/commands/edit.rb |
byebug-1.3.1 | lib/byebug/commands/edit.rb |