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

15 commits

Author SHA1 Message Date
Conrad Irwin
44463e7d85 Stop using compatibility aliases for Pry.config 2014-05-01 01:51:01 -07:00
Robert Gleeson
74135c1890 allow for tests to be run with ease.
'bacon spec/config_spec.rb' instead of 'bacon -I spec spec/config_spec.rb'
2014-03-14 05:31:24 +01:00
Robert Gleeson
77a9c00067 rename Pry::CommandSet#commands as Pry::CommandSet#to_hash.
'Pry.commands.commands' gone in favor of 'Pry.commands.to_hash' or as
using a CommandSet as an enumerable (Pry.commands.each etc) instead.
2014-02-04 05:14:41 +01:00
Ryan Fitzgerald
3bbe0f0c32 Remove support for 1.8-compatible versions of Ruby 2014-01-19 17:43:07 -08:00
Kyrylo Silin
bebf91f558 Update relevant tests in "command_spec.rb"
Make them use the new Slop syntax.
2013-01-14 20:15:01 +02:00
Kyrylo Silin
c38eb20776 Remove old subcommands cruft
* use a plain old Slop instance instead of `Options`;
  * remove `ClassCommand::Options` and its tests;
  * add clearer subcommand example (for `Command#subcommand` method);
  * refactor `ClassCommand#slop`;
  * refactor `ClassCommand#complete`.

Slop v3.4.0 has introduced full-featured subcommands. There is no need
in Pry specific code anymore.
2013-01-14 20:15:01 +02:00
Kyrylo Silin
ad5bb4c399 Assign default value to :listing option
When you create a class command, there is a problem with `:listing`
option, which doesn't carry the correct default value. Consider the
example:

  class MakeMeHappy < Pry::ClassCommand
    match 'woot'
  end

`MakeMeHappy` command matches against 'woot' String, but its `:listing`
option is set to the "nil" String, which is incorrect. We can fix it by
setting `:listing` explicitly:

  command_options :listing => 'woot'

It's a repetitive task, so we can automate it. Holy smoke, this why we
all use computers, after all!

With help of this commit there is no need to set `:listing` manually.
Pry will handle it for you.

Signed-off-by: Kyrylo Silin <kyrylosilin@gmail.com>
2013-01-04 04:56:54 +02:00
John Mair
0aae15c4d9 Define Pry::ClassCommand.inherited hook
This is so commands that subclass other commands inherit the options, match and description.
2013-01-01 21:24:30 +01:00
Kyrylo Silin
c2050dbb49 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>
2012-12-27 13:29:28 +02:00
John Mair
9a279461c1 PryTestHelpers methods are now module_functions, included into Bacon::Context by default 2012-12-07 23:08:49 +01:00
John Mair
31a9578228 cleaned up lib/pry/test/helper.rb
* removed most historicla junk from lib/pry/test/helper.rb
* relocated recalcitrant junk to the local spec/helper.rb (this isn't exposed to 3rd parties)
2012-12-07 21:41:05 +01:00
Kyrylo Silin
8a39813708 Fix subcommands
A few things were missing. I had to add a new method and slightly adjust
ClassCommand#slop method. Without these changes subcommands doesn't work
properly.

Add some unit tests for subcommands.

Signed-off-by: Kyrylo Silin <kyrylosilin@gmail.com>
2012-11-26 18:07:32 +02:00
Kyrylo Silin
30ec15ab1c Rename "sub_command" to "subcommand"
Signed-off-by: Kyrylo Silin <kyrylosilin@gmail.com>
2012-11-23 13:56:58 +02:00
Kyrylo Silin
cf786881bb Extend ClassCommand so it can define sub commands
Create `ClassCommand::Options` class, which ties up sub commands and
default options together.

Let's consider the command `food make --tea`. `food` is a command,
`make` is a sub command and `--tea` is an option of `make` sub command.
We can access `--tea` via `opts[:make][:tea].

Also, we can check the freshness of our food like so: `food --freshness`.
`--freshness` is a default option. We can access it like so:
`opts.freshness?` or `opts[:freshness]`.

Add unit tests for `ClassCommand::Option` and some other tests that
reflect the additions.

Finally, document everything and fix different typos in the existing
documentation.

Signed-off-by: Kyrylo Silin <kyrylosilin@gmail.com>
2012-11-23 13:41:44 +02:00
☈king
848b6bdbeb Rename for tabcompletion-friendliness. 2012-11-15 18:59:51 -06:00
Renamed from test/test_command.rb (Browse further)