Remove the compulsary "" argument to alias_command

This commit is contained in:
Conrad Irwin 2011-09-18 14:36:39 +08:00 committed by John Mair
parent aaf0cac06b
commit 6fda20a22f
8 changed files with 14 additions and 14 deletions

View File

@ -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 File

@ -168,10 +168,10 @@ class Pry
# @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.

View File

@ -91,7 +91,7 @@ class Pry
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 @@ class Pry
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

View File

@ -52,7 +52,7 @@ class Pry
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()

View File

@ -54,7 +54,7 @@ class Pry
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 @@ class Pry
end
end
alias_command "history", "hist", ""
alias_command "history", "hist"
helpers do
def one_index_number(line_number)

View File

@ -60,8 +60,8 @@ class Pry
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()

View File

@ -29,7 +29,7 @@ class Pry
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 File

@ -99,7 +99,7 @@ describe Pry::CommandSet do
@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