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

32 commits

Author SHA1 Message Date
John Mair
f7e0bfadde aliases inherit options from original, fixes #525
* there was an issue where Pry.config.command_prefix needed to be accessed by CommandSet#find_command
before the config options had loaded -- we just avoid this issue by passing in "" if the config option is not yet defined ;)
This is unlikely to cause any issues, but is a naughty hack all the same.
* added tests to ensure options are inherited
2012-04-12 20:58:59 +12:00
John Mair
8d0fa78ce5 moved Pry#complete_expression? et al to Pry::Code
* This is so we can use it without needing a Pry instance present, it also feels like a more natural home for it.
2012-04-11 02:17:35 +12:00
Conrad Irwin
a970d5b29e Show the contents of the process method by default
When creating a command using a custom subclass there may not be a
readily available block. In that case defaulting to the process method
seems reasonable for now.
2012-04-01 16:20:35 -07:00
Conrad Irwin
4fe5f70447 Rename Command#name -> Command#match
The problem with using "name" for this is that several tools expect
Class#name to return a String, and Commands are classes.

This could cause some subtle breakage, but the tests seem ok™
2012-04-01 16:06:15 -07:00
John Mair
87a78be594 remove :alias kruft from Pry::Commands.group method
* Now we're using a proper "Aliases" group we no longer need the :alias junk (neglected to remove this in last commit)
2012-03-28 16:09:57 +13:00
John Mair
527e9d1c19 supercharged Pry.commands.alias_command method
* Now accepts arbitrary command code for alias, e.g
  alias_command "lM", "ls -M"
* Adds all aliases to the "Aliases" group in `help`
2012-03-26 00:28:27 +13:00
John Mair
81c0130815 fixed bug where Command#run "cd .." would error
* error was due to an extra space being appended to string, which messed up `cd` command parsing
* fixed by applying a simple #rstrip; updated tests
2012-03-08 15:38:12 +13:00
John Mair
8ace207020 :takes_block now false by default, removed &block
* blocks can no longer be passed explicitly into commands via command "blah", "desc" |&block| (1.8 compatibility problems)
* blocks must be explicitly enabled for a command with the :takes_block => true option
2012-02-27 14:34:05 +13:00
John Mair
ce920efd66 keep 1.8.7 regex engine happy 2012-02-27 01:15:07 +13:00
John Mair
8e99eddf00 Command block syntax now requires "| do" or "| {"
e.g:
command "hello", "desc" do |&block|
  block.call
end

(pry)> hello | do
(pry)*   puts "mommy, make me all silver!"
(pry)* end
mommy, make me all silver!

* Blocks are now available by default, turn off explicitly with :takes_block => false
2012-02-27 01:08:56 +13:00
Conrad Irwin
3cbeb1cd26 Include listing in help of non-class commands 2012-02-26 01:00:50 -08:00
John Mair
44f057198f added tests for multiple params to block 2012-02-24 05:23:17 +13:00
John Mair
1d57e04c49 Fixed failing tests, working around bug in 1.8
* proc { |&block| }.arity returns 1 on 1.8, but 0 on 1.9
  This is a bug in 1.8 that we had to hack around.
2012-02-24 04:54:07 +13:00
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
abf7e1fe32 Don't mangle plugin names in help 2012-02-22 23:14:51 -08:00
John Mair
b62c10c49e installed pry gem (pry-0.9.8.2) no longer treated as plugin by help
* next for plugin was too general, changed to use /pry-([\w_]+)-([\d\.]+)/
2012-02-23 18:43:56 +13:00
John Mair
4b53a97afa improved 'help' output
* sections separated by white space
* plugin names are nicely formatted, e.g `Plugin: Exception Explorer v0.1.9`
2012-02-23 18:21:31 +13:00
John Mair
1e49f38a1b reshuffed command sets
* deleted Shell, Input, Documentation
* added NavigatingPry, InputAndOutput, Editing
2012-02-23 16:29:10 +13:00
Conrad Irwin
0c65a06f72 Group commands in "help" output 2012-02-19 23:08:16 -08:00
Conrad Irwin
4e8a436460 Prioritise commands by match_score [Fixes #471] 2012-02-11 15:15:22 -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
49994f17ac Allow process() methods to take args too 2012-01-15 15:52:45 -08:00
Conrad Irwin
e784a1a024 Make pry silent with RUBYOPT=-w 2012-01-15 12:21:28 -08:00
Conrad Irwin
76924d98b3 Don't clobber pre-existing options when adding new ones 2012-01-14 20:54:30 -08:00
Conrad Irwin
5b533fe4f1 Class command API polish 2012-01-08 12:49:24 -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
5539f3bebb Make help use Slop where possible 2011-12-31 15:24:10 +00:00
Conrad Irwin
367b353bca Make target_self and command_name methods, not attributes 2011-12-31 15:24:10 +00:00
Conrad Irwin
7b0a5a346c Document Pry::Command 2011-12-31 12:40:01 +00:00
Conrad Irwin
d221a22d02 Merge Pry::CommandContext and Pry::CommandSet::Command into Pry::Command 2011-12-31 11:54:41 +00:00