added experiment rue-(\d) and :(.*) regex commands

This commit is contained in:
John Mair 2011-05-23 19:24:00 +12:00
parent bf0081170e
commit ecc3859866
2 changed files with 10 additions and 3 deletions

View File

@ -12,7 +12,6 @@ class Pry
replacement_line = "" if !replacement_line
input_array = opts[:eval_string].each_line.to_a[0..-2] + [opts[:arg_string] + "\n"]
opts[:eval_string].replace input_array.join("\n")
# binding.pry
end
alias_command "%", "amend-line", ""

View File

@ -7,8 +7,16 @@ class Pry
output.puts opts[:eval_string]
end
command "power" do
instance_eval opts[:ni_arg_string]
command /rue-(\d)/, "Experimental amend-line, where the N in rue-N represents line to replace", :interpolate => false do |replacement_line|
replacement_line = "" if !replacement_line
input_array = opts[:eval_string].each_line.to_a
line_number = opts[:captures].first.to_i
input_array[line_number] = opts[:arg_string]
opts[:eval_string].replace input_array.join("\n")
end
command /:(.*)/, "Experimental shell forwarder, forward all lines after ':' to shell" do
system(opts[:captures].first)
end
command "play-string", "Play a string as input" do