Commit Graph

29 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 ab6fecb119 import and import_from now return the command set 2012-04-02 22:51:40 +12: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 9e9f6a51c3 alias_command: fold sep. desc arg into options hash
* i.e, instead of alias_command "ls", "ls -M", "my description", :options => blah
  use alias_command "ls", "ls -M", :desc => "my description", :options => blah
2012-03-26 04:01:07 +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
Conrad Irwin 127015d723 Move and update "help" specs a bit 2012-02-22 23:56:25 -08:00
Conrad Irwin 656b1fc9aa Put "help" command in its own file 2012-02-22 23:35:07 -08:00
Conrad Irwin 4e8a436460 Prioritise commands by match_score [Fixes #471] 2012-02-11 15:15:22 -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 12cd5507cd Add a test for accidental fixage [Fixes #261] 2012-01-03 01:47:15 +00: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 d221a22d02 Merge Pry::CommandContext and Pry::CommandSet::Command into Pry::Command 2011-12-31 11:54:41 +00:00
Conrad Irwin 2b6d0d2149 Make all the tests pass again 2011-12-31 11:10:55 +00:00
John Mair f52626e169 added some integration tests for class based commands && renamed Pry::CommandContext:Command#block to #callable 2011-12-30 00:34:22 +13:00
John Mair 1cbe7d4c9c made start on tests for class-based commands, also changed API to use :definition => MyCommand.new 2011-12-30 00:34:22 +13:00
John Mair 830e6c8f12 updated rename_command() to accept either actual command name or listing name, tests also updated 2011-11-24 22:33:37 +13:00
John Mair 54df4bf7bd removed repeated/redundant test from test_command_set.rb 2011-11-24 18:38:42 +13:00
John Mair 18c8ccdecc Added rename() method to Pry#CommandSet
This enables whingers like RubyPanther to change commands such as 'ls'
to something more bland so they no longer suffer 'mental pollution'
2011-11-24 18:27:30 +13:00
John Mair 747d80df47 improved some command code and added more tests 2011-11-16 03:09:16 +13:00
John Mair a3723baaab Most command-related methods now accept either command name or listing name.
This should make it easier when aliasing / deleting / importing commands. No longer need to specify full regex.
Also updated tests.
2011-11-16 02:51:17 +13:00
John Mair 4212baca6d added before_command and after_command decorators + tests 2011-11-15 03:12:52 +13:00
Ryan Fitzgerald 892043882e add command_name to context 2011-09-24 23:52:07 -07:00
Conrad Irwin 6fda20a22f Remove the compulsary "" argument to alias_command 2011-09-19 10:37:51 +08:00
John Mair a04e56012a made it so commands (with :keep_retval => true) can now return nil as a legitimate return value. Created a new 'void' value to use instead when indicating no return value. also updated tests.
'void' method now available to commands, commands must return this when they do not want their result displayed when they use :keep_retval => true. void just maps to a random object Pry::CommandContext::VOID_VALUE.
2011-09-04 13:30:20 +12:00
Conrad Irwin 99026e5c4d help command should sort output. 2011-07-27 11:43:28 -07:00
John Mair 71ad2aa9d1 added a bunch more tests for: hist command, :listing option to commands, regex commands, etc. Turned paging off in helper.rb 2011-05-28 18:05:41 +12:00
John Mair bf0081170e new tests for Pry::CommandProcessor and regex command and spaced command functionality, also tests for :interpolate flag for commands 2011-05-23 19:11:41 +12:00
Mon ouïe 1750fe4d78 Got rid of CommandSet#name 2011-05-07 07:32:05 +02:00
John Mair 79868f8266 fixed cd bug for complex arguments, renamed test_commandset to test_command_set 2011-05-06 22:43:08 +12:00