added negative line number support to amend-line

This commit is contained in:
John Mair 2011-06-14 00:50:47 +12:00
parent 6b1b680c06
commit c68b936bcc
1 changed files with 2 additions and 2 deletions

View File

@ -12,7 +12,7 @@ class Pry
render_output(false, 0, Pry.color ? CodeRay.scan(eval_string, :ruby).term : eval_string)
end
command(/amend-line.?(\d+)?(?:\.\.(-?\d+))?/, "Amend a line of input in multi-line mode. Type `amend-line --help` for more information. Aliases %",
command(/amend-line.?(-?\d+)?(?:\.\.(-?\d+))?/, "Amend a line of input in multi-line mode. Type `amend-line --help` for more information. Aliases %",
:interpolate => false, :listing => "amend-line") do |*args|
start_line_number, end_line_number, replacement_line = *args
@ -41,7 +41,7 @@ class Pry
eval_string.replace input_array.join
end
alias_command(/%.?(\d+)?(?:\.\.(-?\d+))?/, /amend-line.?(\d+)?(?:\.\.(-?\d+))?/, "")
alias_command(/%.?(\d+)?(?:\.\.(-?\d+))?/, /amend-line.?(-?\d+)?(?:\.\.(-?\d+))?/, "")
command "play", "Play back a string or a method or a file as input. Type `play --help` for more information." do |*args|
opts = Slop.parse!(args) do |opt|