Fix tester for nested-instance case
Record initial prompt too
Update existing pry_repl test
Simplify return (kyrylo += 1 for spotting it)
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
Refactor `BaseHelpers#find_command`

The problem is that if you use `find_command` method as a class method,
the `commands` will be equal to `nil`, whereas `Pry::Commands` are
guaranteed to exist.

Signed-off-by: Kyrylo Silin <kyrylosilin@gmail.com>
DRYify CommandSet#find_command_by_match_or_listing

Also, refactor `BaseHelpers#find_command` again, so we can choose where
we we want to find our `name`.

Signed-off-by: Kyrylo Silin <kyrylosilin@gmail.com>
Ensure nil doesn't freak out `#find_command`

When you pass `nil` to `BaseHelpers#find_command` and a command in `set`
doesn't have the `:listing` option (for example, when your command is a
regular Ruby class), `#find_command` will return that command (even if
it doesn't match at all).

  command.options[:listing] #=> nil
  name = nil
  command.options[:listing] == name #=> true

Add tests to "code_object_spec.rb", because that's how I found this
shortage and it seems to be a natural test.

Signed-off-by: Kyrylo Silin <kyrylosilin@gmail.com>
Refactor 'command_lookup'

Thanks to Bacon we can use `before` method to simplify our life.
And, blimey, I accidentally left some unwanted code after myself!

Signed-off-by: Kyrylo Silin <kyrylosilin@gmail.com>
Move default command options to its own Proc

First of all, the `CommandSet#default_options` doesn't really belong to
the CommandSet. Secondly, I will use the command options from other
place, but later. Stay tuned!

Signed-off-by: Kyrylo Silin <kyrylosilin@gmail.com>
Make subclassed commands always carry all options

By options I mean the command options like `:listing`, `:shellwords`,
etc.

Signed-off-by: Kyrylo Silin <kyrylosilin@gmail.com>
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>
Move command options Proc under Command namespace

Because it fits better there and is also hidden from the user.

Signed-off-by: Kyrylo Silin <kyrylosilin@gmail.com>
define .source, .doc, etc on Pry::ClassCommand

This is so that Pry::CodeObject can return Pry::ClassCommand objects directly, this is impt
as we want slightly different behaviour than just Pry::WrappedModule(command_class), notably .doc should return
command help rather than comments above the command's class definition.
module_candidate.rb improved class lookup regex

Bug prevented lookup of Deeply::Nested::Class::Definitions.

Also properly differentiate when looking up docs/source for *commands* and for the class that represents the command, i.e:
show-doc show-source #=> displays show-source --help
show-doc Pry::Command::ShowSource #=> comments above class definition (as with any other class)
Move default options to class method of Pry::Command
alliteration
Update bacon
Minor style change (only using CamelCase for classes/modules)
Work around rbx bug by not trying to ls a fixnum