mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
minor changes: added Pry instance (__pry__) to status, changed _pry_ to __pry__, minor aesthetic changes..decreased ljust() for help, changed cd .. match in command_info to regex
This commit is contained in:
parent
571612f4cf
commit
7135d5179e
5 changed files with 13 additions and 8 deletions
|
@ -31,7 +31,7 @@ class Pry
|
|||
"exit_all" => proc do
|
||||
throw(:breakout, 0)
|
||||
end,
|
||||
["exit", "quit", "back", "cd .."] => proc do |opts|
|
||||
["exit", "quit", "back", /cd\s*\.\./] => proc do |opts|
|
||||
throw(:breakout, opts[:nesting].level)
|
||||
end,
|
||||
"ls" => proc do |opts|
|
||||
|
@ -97,7 +97,7 @@ class Pry
|
|||
"nesting" => "Show nesting information.",
|
||||
"status" => "Show status information.",
|
||||
"exit_all" => "End all nested Pry sessions",
|
||||
["exit", "quit", "back", "cd .."] => "End the current Pry session.",
|
||||
["exit", "quit", "back", /cd\s*\.\./] => "End the current Pry session.",
|
||||
"ls" => "Show the list of vars in the current scope.",
|
||||
"cat" => "Show output of <var>.inspect",
|
||||
"cd" => "Start a Pry session on <var> (use `cd ..` to go back)",
|
||||
|
@ -114,10 +114,10 @@ class Pry
|
|||
out.puts "Command list:"
|
||||
out.puts "--"
|
||||
command_info.each do |k, v|
|
||||
puts "#{Array(k).first}".ljust(33) + v
|
||||
puts "#{Array(k).first}".ljust(18) + v
|
||||
end
|
||||
else
|
||||
key = command_info.keys.find { |v| Array(v).any? { |k| k == param } }
|
||||
key = command_info.keys.find { |v| Array(v).any? { |k| k === param } }
|
||||
if key
|
||||
out.puts command_info[key]
|
||||
else
|
||||
|
@ -144,6 +144,7 @@ class Pry
|
|||
out.puts "Receiver: #{Pry.view(target.eval('self'))}"
|
||||
out.puts "Nesting level: #{nesting.level}"
|
||||
out.puts "Local variables: #{target.eval('Pry.view(local_variables)')}"
|
||||
out.puts "Pry instance: #{Pry.active_instance}"
|
||||
out.puts "Last result: #{Pry.view(Pry.last_result)}"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,6 +3,7 @@ class Pry
|
|||
case value
|
||||
when Exception
|
||||
output.puts "#{value.class}: #{value.message}"
|
||||
output.puts "from #{value.backtrace.first}"
|
||||
else
|
||||
output.puts "=> #{Pry.view(value)}"
|
||||
end
|
||||
|
|
|
@ -14,4 +14,7 @@ class Pry
|
|||
"pry(#{Pry.view(v)}):#{Pry.view(nest)}* "
|
||||
end
|
||||
end
|
||||
|
||||
SIMPLE_PROMPT = proc { "pry> " }
|
||||
SIMPLE_WAIT = proc { "pry* " }
|
||||
end
|
||||
|
|
|
@ -34,9 +34,9 @@ class Pry
|
|||
|
||||
Pry.active_instance = self
|
||||
|
||||
# Make sure _ exists
|
||||
# Make sure special locals exist
|
||||
target.eval("__pry__ = Pry.active_instance")
|
||||
target.eval("_ = Pry.last_result")
|
||||
target.eval("_pry_ = Pry.active_instance")
|
||||
|
||||
break_level = catch(:breakout) do
|
||||
nesting << [nesting.size, target_self]
|
||||
|
@ -67,7 +67,7 @@ class Pry
|
|||
target = binding_for(target)
|
||||
Pry.last_result = target.eval r(target)
|
||||
Pry.active_instance = self
|
||||
target.eval("_pry_ = Pry.active_instance")
|
||||
target.eval("__pry__ = Pry.active_instance")
|
||||
target.eval("_ = Pry.last_result")
|
||||
rescue SystemExit => e
|
||||
exit
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
class Pry
|
||||
VERSION = "0.3.0"
|
||||
VERSION = "0.4.0"
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue