diff options
author | Kyrylo Silin <kyrylosilin@gmail.com> | 2012-08-11 00:23:40 +0300 |
---|---|---|
committer | Kyrylo Silin <kyrylosilin@gmail.com> | 2012-11-21 04:56:27 +0200 |
commit | e5167d185940842216194e0328bfce7fc812cdb4 (patch) | |
tree | b9bcffe8a45b02c913c8a371b654d8f264d13bb3 | |
parent | e93e331b774ea07b88ea99d7b92abed5811e8d62 (diff) | |
download | pry-e5167d185940842216194e0328bfce7fc812cdb4.tar.gz |
Rename "sub_command" to "subcommand"
Signed-off-by: Kyrylo Silin <kyrylosilin@gmail.com>
-rw-r--r-- | lib/pry/command.rb | 22 | ||||
-rw-r--r-- | spec/command_spec.rb | 10 |
2 files changed, 16 insertions, 16 deletions
diff --git a/lib/pry/command.rb b/lib/pry/command.rb index 95b6256a..6d980757 100644 --- a/lib/pry/command.rb +++ b/lib/pry/command.rb @@ -473,7 +473,7 @@ class Pry # gems your command needs to run, or to set up state. class ClassCommand < Command - # The class that couples together sub commands and top-level options (that + # The class that couples together subcommands and top-level options (that # are known as "default" options). The explicitly defined instance methods # of this class provide the coupling with default options of a # Slop::Commands instance. An instance of this class delegates all remaining @@ -496,7 +496,7 @@ class Pry # opts.default # # => #<Slop ...> # - # # Parse sub commands. + # # Parse subcommands. # opts.parse %'action --force' # opts[:action].present?(:force) # # => true @@ -513,7 +513,7 @@ class Pry # # => NoMethodError class Options < SimpleDelegator - # @param [Slop::Commands] opts The sub commands and options. + # @param [Slop::Commands] opts The subcommands and options. # @raise [ArgumentError] if the +opts+ isn't a kind of Slop::Commands. # instance. def initialize(opts) @@ -526,11 +526,11 @@ class Pry # Fetch the instance of Slop tied to a command or fetch an options # argument value. # - # If the +key+ doesn't correspond to any of the sub commands, the method + # If the +key+ doesn't correspond to any of the subcommands, the method # tries to find the same +key+ in the list of default options. # # @example - # # A sub command example. + # # A subcommand example. # opts = Options.new(commands) # opts.parse %w'download video.ogv' # @@ -543,7 +543,7 @@ class Pry # opts[:host] # # => true # - # @param [String, Symbol] key The sub command name or the default option. + # @param [String, Symbol] key The subcommand name or the default option. # @return [Slop, Boolean, nil] Either instance of Slop tied to the # command, if any; or `true`, if the default option has the given +key+; # or nil, if can't find the +key+. @@ -623,7 +623,7 @@ class Pry slop.help end - # Return an instance of Slop::Commands that can parse either sub commands + # Return an instance of Slop::Commands that can parse either subcommands # or the options that this command accepts. def slop opts = proc do |opt| @@ -633,7 +633,7 @@ class Pry end Slop::Commands.new do |cmd| - sub_commands(cmd) + subcommands(cmd) cmd.default { |opt| opts.call(opt) } end end @@ -659,17 +659,17 @@ class Pry # end def setup; end - # A method to setup Slop::Commands so it can parse the sub commands your + # A method to setup Slop::Commands so it can parse the subcommands your # command expects. If you need to set up default values, use `setup` # instead. # # @example - # def sub_commands(cmd) + # def subcommands(cmd) # cmd.on(:d, :download, "Download a content from a server.") do # @action = :download # end # end - def sub_commands(cmd); end + def subcommands(cmd); end # A method to setup Slop so it can parse the options your command expects. # diff --git a/spec/command_spec.rb b/spec/command_spec.rb index ba127733..1d874b82 100644 --- a/spec/command_spec.rb +++ b/spec/command_spec.rb @@ -242,14 +242,14 @@ describe "Pry::Command" do describe 'classy api' do - it 'should call setup, then sub_commands, then options, then process' do + it 'should call setup, then subcommands, then options, then process' do cmd = @set.create_command 'rooster', "Has a tasty towel" do def setup output.puts "setup" end - def sub_commands(cmd) - output.puts "sub_commands" + def subcommands(cmd) + output.puts "subcommands" end def options(opt) @@ -261,7 +261,7 @@ describe "Pry::Command" do end end - mock_command(cmd).output.should == "setup\nsub_commands\noptions\nprocess\n" + mock_command(cmd).output.should == "setup\nsubcommands\noptions\nprocess\n" end it 'should raise a command error if process is not overridden' do @@ -303,7 +303,7 @@ describe "Pry::Command" do it 'should provide cmds and args as provided by slop' do cmd = @set.create_command 'dichlorvos', 'Kill insects' do - def sub_commands(cmd) + def subcommands(cmd) cmd.on :kill do on :i, :insect, "An insect." end |