diff --git a/lib/pry/commands.rb b/lib/pry/commands.rb index c96d47d8..d868a9e7 100644 --- a/lib/pry/commands.rb +++ b/lib/pry/commands.rb @@ -23,6 +23,9 @@ class Pry Pry.start(target) end + command ".", "All text following a '.' is forwarded to the shell." do + end + command "exit-program", "End the current program. Aliases: quit-program, !!!" do exit end @@ -34,15 +37,15 @@ class Pry run target, ".ri", *args end - command "gist-method", "" do |*args| + command "gist-method", "Gist a method to github.", :requires_gem => "gist" do |*args| options = { } meth_name = nil OptionParser.new do |opts| - opts.banner = %{Usage: show-command [OPTIONS] [CMD] + opts.banner = %{Usage: gist-method [OPTIONS] [METH] Gist the method (doc or source) to github. e.g: gist -m my_method -e.g gist -d my_method +e.g: gist -d my_method -- } opts.on("-m", "--method", "Gist a method's source.") do |line| @@ -61,6 +64,8 @@ e.g gist -d my_method meth_name = v end + next if options[:h] + meth_name = meth_name_from_binding(target) if !meth_name if (meth = get_method_object(meth_name, target, options)).nil? diff --git a/test/test.rb b/test/test.rb index e5a093b9..e1711607 100644 --- a/test/test.rb +++ b/test/test.rb @@ -434,8 +434,9 @@ describe Pry do end end - Command2.commands.keys.size.should == 2 + Command2.commands.keys.size.should == 3 Command2.commands.keys.include?("help").should == true + Command2.commands.keys.include?("install").should == true Command2.commands.keys.include?("h").should == true Object.remove_const(:Command2)