mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
Allowed to change description of a command in CommandSet
This commit is contained in:
parent
4118d239b4
commit
575c089276
2 changed files with 19 additions and 0 deletions
|
@ -102,5 +102,17 @@ class Pry
|
|||
raise NoCommandError.new(name, self)
|
||||
end
|
||||
end
|
||||
|
||||
# Sets the description for a command (replacing the old
|
||||
# description.)
|
||||
# @param [String] name The command name.
|
||||
# @param [String] description The command description.
|
||||
# @example
|
||||
# MyCommands = Pry::CommandSet.new :test do
|
||||
# desc "help", "help description"
|
||||
# end
|
||||
def desc(name, description)
|
||||
commands[name].description = description
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -904,4 +904,11 @@ describe Pry::CommandSet do
|
|||
@set.run_command nil, 'bar'
|
||||
run.should == true
|
||||
end
|
||||
|
||||
it 'should be able to change the descritpions of methods' do
|
||||
@set.command('foo', 'bar') {}
|
||||
@set.desc 'foo', 'baz'
|
||||
|
||||
@set.commands['foo'].description.should == 'baz'
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue