Guest User

Untitled

a guest
Feb 20th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. #!/usr/bin/env ruby
  2.  
  3. $:.unshift(File.dirname(__FILE__) + "/../lib")
  4. require "rubygems"
  5. begin
  6. require "gist"
  7. rescue LoadError
  8. puts "Please install rubygem 'gist' to use this command"
  9. exit
  10. end
  11. selection = nil
  12. if ENV['TM_SELECTED_TEXT']
  13. selection = ENV['TM_SELECTED_TEXT']
  14. else
  15. selection = STDIN.read
  16. end
  17.  
  18. if url = Gist.write(selection, ARGV[0] == "private" ? true : false)
  19. puts "Created gist at #{url}. URL copied to clipboard."
  20. end
Add Comment
Please, Sign In to add comment