mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
fixed some bugs in gist-method
command and gave it a dependency on
'gist' gem. Added `.<shell command>` descriptive command (cannot be executed). Fixed tests.
This commit is contained in:
parent
ceb557b935
commit
3ad0616d44
2 changed files with 10 additions and 4 deletions
|
@ -23,6 +23,9 @@ class Pry
|
|||
Pry.start(target)
|
||||
end
|
||||
|
||||
command ".<shell 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?
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue