summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author0xAB <0xAB@protonmail.com>2017-09-02 14:06:26 +0100
committer0xAB <0xAB@protonmail.com>2017-09-02 14:06:26 +0100
commitade21836df532f38a3d68b5358ee13252fd96d4b (patch)
tree0020069b07ee195c15c6f0753d1e767d6d82dd33
parentef09ca1b6cb8b3d2a4bc6f74200d721c6769971a (diff)
downloadpry-ade21836df532f38a3d68b5358ee13252fd96d4b.tar.gz
remove need for explicit argument pass of '_pry_' in list-prompts command.
-rw-r--r--lib/pry/commands/list_prompts.rb2
-rw-r--r--lib/pry/prompt.rb2
-rw-r--r--lib/pry/pry_instance.rb1
3 files changed, 3 insertions, 2 deletions
diff --git a/lib/pry/commands/list_prompts.rb b/lib/pry/commands/list_prompts.rb
index 6c426fdf..e5defe5a 100644
--- a/lib/pry/commands/list_prompts.rb
+++ b/lib/pry/commands/list_prompts.rb
@@ -13,7 +13,7 @@ class Pry::Command::ListPrompts < Pry::ClassCommand
output.puts heading("Available prompts") + "\n\n"
all_prompts.each do |prompt|
next if prompt.alias?
- aliases = Pry::Prompt.aliases_for(prompt.name, _pry_)
+ aliases = _pry_.h.aliases_for(prompt.name)
output.write "Name: #{text.bold(prompt.name)}"
output.puts selected_prompt?([prompt].concat(aliases)) ? text.green(" [active]") : ""
output.puts "Aliases: #{aliases.map {|s| text.bold(s.name) }.join(',')}" if aliases.any?
diff --git a/lib/pry/prompt.rb b/lib/pry/prompt.rb
index 632aaf3c..4cf9e1ac 100644
--- a/lib/pry/prompt.rb
+++ b/lib/pry/prompt.rb
@@ -112,7 +112,7 @@ module Pry::Prompt
def [](name)
all_prompts.find {|prompt| prompt.name == name.to_s }
end
-
+ alias_method :get_prompt, :[]
#
# @param [String] name
# The name of a prompt.
diff --git a/lib/pry/pry_instance.rb b/lib/pry/pry_instance.rb
index b48bd9ed..1ebc4d2b 100644
--- a/lib/pry/pry_instance.rb
+++ b/lib/pry/pry_instance.rb
@@ -98,6 +98,7 @@ class Pry
Module.new do
include Pry::Helpers::Text
include Pry::Helpers::BaseHelpers
+ include Pry::Prompt
define_method(:_pry_) { this }
extend self
public_class_method *Pry::Helpers::BaseHelpers.methods(false)