droplr.rb 509 B

12345678910111213141516171819202122232425
  1. #!/usr/bin/env ruby
  2. #
  3. # droplr
  4. # Fabio Fernandes | http://fabiofl.me
  5. #
  6. # Use Droplr from the comand line to upload files and shorten links.
  7. #
  8. # Examples:
  9. #
  10. # droplr ./path/to/file/
  11. # droplr http://example.com
  12. #
  13. # This needs Droplr.app to be installed and loged in.
  14. # Also, Mac only.
  15. if ARGV[0].nil?
  16. puts "You need to specify a parameter."
  17. exit!(1)
  18. end
  19. if ARGV[0][%r{^http[|s]://}i]
  20. `osascript -e 'tell app "Droplr" to shorten "#{ARGV[0]}"'`
  21. else
  22. `open -ga /Applications/Droplr.app "#{ARGV[0]}"`
  23. end