ShowDoc: display "current context" message

Consider the following example:

  [1] pry(main)> show-doc
  Error: No docs found for:
  [2] pry(main)>

The message is ambiguous. This commit adds "current context" label when
`obj_name` return `nil`.

  [1] pry(main)> show-doc
  Error: No docs found for: current context
  [2] pry(main)>
This commit is contained in:
Kyrylo Silin 2013-03-13 13:15:58 +02:00
parent e926d8c944
commit d746eeffe3
1 changed files with 5 additions and 1 deletions

View File

@ -35,7 +35,11 @@ class Pry
# command '--help' shouldn't use markup highlighting
docs
else
raise CommandError, "No docs found for: #{obj_name}" if docs.empty?
if docs.empty?
raise CommandError, "No docs found for: #{
obj_name ? obj_name : 'current context'
}"
end
process_comment_markup(docs)
end
end