1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00

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

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|