Permalink
Browse files

Remove the compulsary "" argument to alias_command

  • Loading branch information...
1 parent aaf0cac commit 6fda20a22fbc60d375a7c03c82701d9f96c7780c @ConradIrwin ConradIrwin committed with banister Sep 18, 2011
@@ -14,7 +14,7 @@ class MyCommands < Pry::CommandBase
import_from Pry::Commands, "status"
# analogy to Ruby's native alias_method idiom for decorating a method
- alias_command "old_status", "status", ""
+ alias_command "old_status", "status"
# Invoke one command from within another using `run`
command "status", "Modified status." do |x|
View
@@ -168,10 +168,10 @@ def import_from(set, *names)
# @param [String] new_name New name of the command.
# @param [String] old_name Old name of the command.
# @param [String, nil] desc New description of the command.
- def alias_command(new_name, old_name, desc = nil)
+ def alias_command(new_name, old_name, desc="")
commands[new_name] = commands[old_name].dup
commands[new_name].name = new_name
- commands[new_name].description = desc if desc
+ commands[new_name].description = desc
end
# Runs a command.
@@ -91,7 +91,7 @@ module DefaultCommands
throw(:breakout, target.eval(arg_string))
end
- alias_command "!!@", "exit-all", ""
+ alias_command "!!@", "exit-all"
command "exit", "Pop the current binding and return to the one immediately prior. Note this does NOT exit the program. Aliases: quit", :keep_retval => true do
if _pry_.binding_stack.one?
@@ -111,15 +111,15 @@ module DefaultCommands
end
end
- alias_command "quit", "exit", ""
+ alias_command "quit", "exit"
command "exit-program", "End the current program. Aliases: quit-program, !!!" do
Pry.save_history if Pry.config.history.should_save
Kernel.exit target.eval(arg_string).to_i
end
- alias_command "quit-program", "exit-program", ""
- alias_command "!!!", "exit-program", ""
+ alias_command "quit-program", "exit-program"
+ alias_command "!!!", "exit-program"
command "!pry", "Start a Pry session on current self; this even works mid multi-line expression." do
target.pry
@@ -52,7 +52,7 @@ module DefaultCommands
end
end
- alias_command "?", "show-doc", ""
+ alias_command "?", "show-doc"
command "stat", "View method information and set _file_ and _dir_ locals. Type `stat --help` for more info." do |*args|
target = target()
@@ -54,7 +54,7 @@ module DefaultCommands
run "show-input"
end
- alias_command(/%.?(-?\d+)?(?:\.\.(-?\d+))?/, /amend-line(?: (-?\d+)(?:\.\.(-?\d+))?)?/, "")
+ alias_command(/%.?(-?\d+)?(?:\.\.(-?\d+))?/, /amend-line(?: (-?\d+)(?:\.\.(-?\d+))?)?/)
command "play", "Play back a string variable or a method or a file as input. Type `play --help` for more information." do |*args|
opts = Slop.parse!(args) do |opt|
@@ -270,7 +270,7 @@ module DefaultCommands
end
end
- alias_command "history", "hist", ""
+ alias_command "history", "hist"
helpers do
def one_index_number(line_number)
@@ -60,8 +60,8 @@ module DefaultCommands
end
end
- alias_command "show-source", "show-method", ""
- alias_command "$", "show-method", ""
+ alias_command "show-source", "show-method"
+ alias_command "$", "show-method"
command "show-command", "Show the source for CMD. Type `show-command --help` for more info." do |*args|
target = target()
@@ -29,7 +29,7 @@ module DefaultCommands
end
end
- alias_command "file-mode", "shell-mode", ""
+ alias_command "file-mode", "shell-mode"
command "cat", "Show output of file FILE. Type `cat --help` for more information." do |*args|
start_line = 0
View
@@ -99,7 +99,7 @@
@set.alias_command 'bar', 'foo'
@set.commands['bar'].name.should == 'bar'
- @set.commands['bar'].description.should == 'stuff'
+ @set.commands['bar'].description.should == ''
@set.run_command nil, 'bar'
run.should == true

0 comments on commit 6fda20a

Please sign in to comment.