diff --git a/lib/pry/commands/show_doc.rb b/lib/pry/commands/show_doc.rb index 9a436c92..1c362504 100644 --- a/lib/pry/commands/show_doc.rb +++ b/lib/pry/commands/show_doc.rb @@ -130,6 +130,22 @@ class Pry def use_line_numbers? opts.present?(:b) || opts.present?(:l) end + + def complete(input) + if input =~ /([^ ]*)#([a-z0-9_]*)\z/ + prefix, search = [$1, $2] + methods = begin + Pry::Method.all_from_class(binding.eval(prefix)) + rescue RescuableException => e + return super + end + methods.map do |method| + [prefix, method.name].join('#') if method.name.start_with?(search) + end.compact + else + super + end + end end Pry::Commands.alias_command "?", "show-doc" end diff --git a/lib/pry/commands/show_source.rb b/lib/pry/commands/show_source.rb index cbfbc5c3..f0eae690 100644 --- a/lib/pry/commands/show_source.rb +++ b/lib/pry/commands/show_source.rb @@ -111,6 +111,22 @@ class Pry def use_line_numbers? opts.present?(:b) || opts.present?(:l) end + + def complete(input) + if input =~ /([^ ]*)#([a-z0-9_]*)\z/ + prefix, search = [$1, $2] + methods = begin + Pry::Method.all_from_class(binding.eval(prefix)) + rescue RescuableException => e + return super + end + methods.map do |method| + [prefix, method.name].join('#') if method.name.start_with?(search) + end.compact + else + super + end + end end Pry::Commands.alias_command "show-method", "show-source" diff --git a/lib/pry/helpers/module_introspection_helpers.rb b/lib/pry/helpers/module_introspection_helpers.rb index 77e31df9..b4d89f97 100644 --- a/lib/pry/helpers/module_introspection_helpers.rb +++ b/lib/pry/helpers/module_introspection_helpers.rb @@ -126,21 +126,6 @@ class Pry end end - def complete(input) - if input =~ /([^ ]*)#([a-z0-9_]*)\z/ - prefix, search = [$1, $2] - methods = begin - Pry::Method.all_from_class(binding.eval(prefix)) - rescue RescuableException => e - return super - end - methods.map do |method| - [prefix, method.name].join('#') if method.name.start_with?(search) - end.compact - else - super - end - end end end end diff --git a/notes.yml b/notes.yml index 141eebd3..409fab56 100644 --- a/notes.yml +++ b/notes.yml @@ -23,3 +23,5 @@ gist: commands (e.g show-source)\n* files (e.g alpha.rb)\n\nExplicit flags (do these need their own syntax to avoid flags?)\n-i input expressions\n-o output expressions\n--hist history\n\n" +show-source: +- it displays 'Other options' at top of help output when u do help show-source *BUG*