1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00
Commit graph

26 commits

Author SHA1 Message Date
Kyrylo Silin
e252aacf91 commands/show_source: handle when source is nil but comment exists
Fixes https://github.com/pry/pry/issues/1452.
($ RuntimeError.exception fails)

Alternative to https://github.com/pry/pry/pull/1453.
2018-10-04 03:46:33 +08:00
Kyrylo Silin
c6f8d5c632 Revert "Get rid of Code#highlighted"
This reverts commit 5599b0a976.

And fixes jruby-head.

https://travis-ci.org/pry/pry/jobs/30420112
2014-07-20 17:32:17 -07:00
Conrad Irwin
5599b0a976 Get rid of Code#highlighted 2014-05-09 20:16:02 -07:00
Conrad Irwin
2ad1b3a1c2 add color more confidently 2014-05-01 01:53:53 -07:00
Conrad Irwin
01785a8020 Start using Pry::Code#highlighted
Before this change the watch command was broken because Pry::Code#to_s
contained ansi codes which it passed into eval.
2014-05-01 01:51:02 -07:00
Robert Gleeson
c31c80c597 docs, again 2014-04-27 14:11:07 -07:00
Robert Gleeson
e80eb75f59 small doc tweak in show-source 2014-04-27 14:11:02 -07:00
yui-knk
c42caac680 Fix typo in show_source.rb
1. delete EXPRESSION from usage in BANNER, because user can use EXPRESSION only when -e option is given.

2. add `show-source Pry.foo -e` example to BANNER.

3. rename parameter of options method from `opts` to `opt`, because in other commands `opt` is used.
2014-04-27 14:10:39 -07:00
Robert Gleeson
f65c62a95c add '$ -e', and 'show-source -e'.
evaluates the argument to the pry command as an expression and returns
the source for the return value of the expression. i need to add tests
as well as update changelog.

closes #1184
2014-04-27 14:04:52 -07:00
John Mair
7c8f9be176 Show error when no docs found 2013-03-10 00:19:10 +01:00
John Mair
b7e70db004 show-source/show-doc: Show the first module candidate with source/docs
Prior to this change `show-source ActiveRecord::Base` would fail, as the highest ranked
candidate couldn't be discovered.
2013-01-29 15:25:05 +01:00
John Mair
2e40eb24c6 re-add reload-method as an alias for reload-code
Turns out some people actually used reload-method, so we re-add it to avoid them getting angry
2013-01-29 15:25:05 +01:00
John Mair
a604fd6972 show-source: prettier error messages 2013-01-12 22:29:32 +01:00
Kyrylo Silin
256f35422a Prettify command descriptions, switches and stuff
Wrap command descriptions to 80 characters. Convert some string options
to symbols (where possible). Align options in code. Remove dots in the
end of switch descriptions.

Signed-off-by: Kyrylo Silin <kyrylosilin@gmail.com>
2013-01-09 22:23:19 +02:00
John Mair
c4dc8cffcd pull more show-source/show-doc methods into their superclass 2013-01-01 22:45:51 +01:00
John Mair
a5a4218660 Define a command superclass for show-source and show-doc
Pry::Command::ShowInfo is an abstract base class.
2013-01-01 21:25:23 +01:00
Kyrylo Silin
ebccd57013 Convert all commands to classes
John "banister" Mair describes the following key features of commands
as classes:

  1. It enables people to extend them by either subclassing or
     monkeypatching.
  2. It enables them to provide their own API, so that for example, the
     Pry::Command::Edit class could have class methods for people to
     configure it.

Please, note that I didn't touch easter eggs commands. I also prettified
some strings (your source code reading experience should vastly improve!).

Signed-off-by: Kyrylo Silin <kyrylosilin@gmail.com>
2012-12-27 13:31:37 +02:00
John Mair
407b20470a improve show-source/show-doc via Pry::CodeObject::Helpers mixin
Pry::CodeObject::Helpers mixin provides the following methods:
command?
module_with_yard_docs?
real_method_object?
c_method?

which are then mixed into the code objects: Pry::Command, Pry::Method, Pry::WrappedModule, Pry::WrappedModule::Candidate
2012-12-25 13:50:42 +01:00
John Mair
37b9fce976 show-source / show-doc: ensure _file_ and _line_ are set
Also cleaned up some OCD edge cases for show-doc, totally unnecessary & kind of silly
2012-12-22 22:59:03 +01:00
John Mair
9e7287a18f show-source/show-doc: temporaily adding complete() method to both commands
Until we find a better home for it, the code for the complete() method is exactly
the same in each case so we should come up with a way for show-source/show-doc to share it.
2012-12-21 16:57:19 +01:00
John Mair
eda2c73afb make show-source code more readable 2012-12-20 20:46:33 +01:00
John Mair
47d30a139c free show-source from the horror of module_introspection_helpers.rb and method_options.rb
show-doc and edit and a variety of other commands can also be updated to use the new Pry::CodeObject API
2012-12-20 20:15:00 +01:00
John Mair
81554dda0a migrating show-source over to new Pry::CodeObject API 2012-12-20 18:05:42 +01:00
Reginald Tan
3836179181 Depracated show-command and moved its functionality to show-source
Also, show-doc on commands now displays their banner
2012-08-14 00:18:53 -04:00
Ryan Fitzgerald
1af4207c63 Restore groups, convert most commands to class syntax 2012-08-11 18:27:26 -07:00
Ryan Fitzgerald
8ce49ee081 Remove extended_commands, default_commands -> commands 2012-08-11 17:39:25 -07:00
Renamed from lib/pry/default_commands/show_source.rb (Browse further)