class Pry::CommandSet
def rename_command(new_match, search, options = {})
- Example: Renaming the `ls` command and changing its description. -
Parameters:
-
options
(Hash
) -- The optional configuration parameters, -
search
(String, Regexp
) -- The command's current match or listing. -
new_match
(String, Regexp
) -- The new match for the command.
def rename_command(new_match, search, options = {}) cmd = find_command_by_match_or_listing(search) options = { listing: new_match, description: cmd.description }.merge!(options) @commands[new_match] = cmd.dup @commands[new_match].match = new_match @commands[new_match].description = options.delete(:description) @commands[new_match].options.merge!(options) @commands.delete(cmd.match) end