Commit Graph

8 Commits

Author SHA1 Message Date
John Mair 90d6f3eefb added support for passing blocks to commands
* Example, using &block:
 Pry.commands.command "tobina", "desc", :takes_block => true do |&block|
   block.call
 end

(pry)> tobina { puts "hi" }
hi
(pry)>
* Works with process(&block) too (for create_command)
* Works with do/end blocks and {} blocks, both single and multi-line

* Example, using command_block:
  Pry.commands.command "tobina", "desc", :takes_block => true do
    command_block.call
  end
2012-02-24 03:40:52 +13:00
Conrad Irwin 656b1fc9aa Put "help" command in its own file 2012-02-22 23:35:07 -08:00
Conrad Irwin 2a6f391275 Check for command-name collision on assignment [Fixes #450] 2012-01-28 19:44:45 -08:00
John Mair 312bb7eee4 command_class no longer alias for create_command
* removed as an alias
* converted remaining commands over to create_command
* removed references in tests
2012-01-22 12:17:43 +13:00
Conrad Irwin 76924d98b3 Don't clobber pre-existing options when adding new ones 2012-01-14 20:54:30 -08:00
Conrad Irwin 45c6492e7e Split CommandProcessor responsibility between CommandSet and Command
The CommandSet is responsible for storing Commands, while the Commands
themselves are responsible for all the parsing.

(Before this change, the CommandProcessor used to do both the searching
within the CommandSet's and also the tokenization of command arguments)
2012-01-03 01:35:32 +00:00
Conrad Irwin bb48077241 Remove parse_options! API
Having classy commands means it's much easier to implement, so we just
require those instead.
2011-12-31 16:05:14 +00:00
Conrad Irwin f8c2d04dce Test new command api 2011-12-31 15:24:11 +00:00