diff --git a/lib/pry.rb b/lib/pry.rb index 3e7211ce..9cf0615d 100644 --- a/lib/pry.rb +++ b/lib/pry.rb @@ -130,6 +130,19 @@ class Pry end end + Pry::DEFAULT_COMMAND_OPTIONS = proc do |match| + { + :requires_gem => [], + :keep_retval => false, + :argument_required => false, + :interpolate => true, + :shellwords => true, + :listing => (String === match ? match : match.inspect), + :use_prefix => true, + :takes_block => false + } + end + # Store the current working directory. This allows show-source etc. to work if # your process has changed directory since boot. [Issue #675] INITIAL_PWD = Dir.pwd diff --git a/lib/pry/command_set.rb b/lib/pry/command_set.rb index b7fe255b..c5c94608 100644 --- a/lib/pry/command_set.rb +++ b/lib/pry/command_set.rb @@ -81,7 +81,7 @@ class Pry # # number-N regex command def block_command(match, description="No description.", options={}, &block) description, options = ["No description.", description] if description.is_a?(Hash) - options = default_options(match).merge!(options) + options = Pry::DEFAULT_COMMAND_OPTIONS.call(match).merge!(options) commands[match] = Pry::BlockCommand.subclass(match, description, options, helper_module, &block) end @@ -113,7 +113,7 @@ class Pry # def create_command(match, description="No description.", options={}, &block) description, options = ["No description.", description] if description.is_a?(Hash) - options = default_options(match).merge!(options) + options = Pry::DEFAULT_COMMAND_OPTIONS.call(match).merge!(options) commands[match] = Pry::ClassCommand.subclass(match, description, options, helper_module, &block) commands[match].class_eval(&block) @@ -362,21 +362,6 @@ class Pry end.map{ |command| command + " " } + Bond::DefaultMission.completions end end - - private - - def default_options(match) - { - :requires_gem => [], - :keep_retval => false, - :argument_required => false, - :interpolate => true, - :shellwords => true, - :listing => (String === match ? match : match.inspect), - :use_prefix => true, - :takes_block => false - } - end end # Wraps the return result of process_commands, indicates if the