Created
November 10, 2008 11:54
-
-
Save drnic/23477 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
$:.unshift(File.dirname(__FILE__) + "/../lib") | |
require "rubygems" | |
begin | |
require "gist" | |
rescue LoadError | |
puts "Please install rubygem 'gist' to use this command" | |
exit | |
end | |
selection = nil | |
if ENV['TM_SELECTED_TEXT'] | |
selection = ENV['TM_SELECTED_TEXT'] | |
else | |
selection = STDIN.read | |
end | |
if url = Gist.write(selection, ARGV[0] == "private" ? true : false) | |
puts "Created gist at #{url}. URL copied to clipboard." | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment