mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
Changed gist-method to use Gist.write instead of popen
This commit is contained in:
parent
9132003887
commit
d157c5a4d6
1 changed files with 7 additions and 3 deletions
|
@ -95,6 +95,8 @@ e.g: stat hello_method
|
||||||
end
|
end
|
||||||
|
|
||||||
command "gist-method", "Gist a method to github. Type `gist-method --help` for more info.", :requires_gem => "gist" do |*args|
|
command "gist-method", "Gist a method to github. Type `gist-method --help` for more info.", :requires_gem => "gist" do |*args|
|
||||||
|
require 'gist'
|
||||||
|
|
||||||
target = target()
|
target = target()
|
||||||
|
|
||||||
opts = Slop.parse!(args) do |opts|
|
opts = Slop.parse!(args) do |opts|
|
||||||
|
@ -134,9 +136,11 @@ e.g: gist -d my_method
|
||||||
code_type = :plain
|
code_type = :plain
|
||||||
end
|
end
|
||||||
|
|
||||||
IO.popen("gist#{' -p' if opts.p?} -t #{type_map[code_type]} -", "w") do |gist|
|
link = Gist.write([:extension => ".#{type_map[code_type]}",
|
||||||
gist.puts content
|
:input => content],
|
||||||
end
|
opts.p?)
|
||||||
|
|
||||||
|
output.puts "Gist created at #{link}"
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue