From 4f0134e955b077275eb6d47efaee0004e38cca78 Mon Sep 17 00:00:00 2001 From: Fabio Fernandes Date: Sat, 13 Jul 2013 05:27:37 -0300 Subject: [PATCH 1/2] Added Droplr plugin. --- plugins/droplr/droplr.plugin.zsh | 3 +++ plugins/droplr/droplr.rb | 25 +++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 plugins/droplr/droplr.plugin.zsh create mode 100755 plugins/droplr/droplr.rb diff --git a/plugins/droplr/droplr.plugin.zsh b/plugins/droplr/droplr.plugin.zsh new file mode 100644 index 000000000..a20ca9368 --- /dev/null +++ b/plugins/droplr/droplr.plugin.zsh @@ -0,0 +1,3 @@ +#!/bin/zsh + +alias droplr=$ZSH/plugins/droplr/droplr.rb \ No newline at end of file diff --git a/plugins/droplr/droplr.rb b/plugins/droplr/droplr.rb new file mode 100755 index 000000000..4af49906d --- /dev/null +++ b/plugins/droplr/droplr.rb @@ -0,0 +1,25 @@ +#!/usr/bin/env ruby +# +# droplr +# Fabio Fernandes | http://fabiofl.me +# +# Use Droplr from the comand line to upload files and shorten links. +# +# Examples: +# +# droplr ./path/to/file/ +# droplr http://example.com +# +# This needs Droplr.app to be installed and loged in. +# Also, Mac only. + +if ARGV[0].nil? + puts "You need to specify a parameter." + exit!(1) +end + +if ARGV[0][%r{^http?://|https://}i] + `osascript -e 'tell app "Droplr" to shorten "#{ARGV[0]}"'` +else + `open -ga /Applications/Droplr.app "#{ARGV[0]}"` +end \ No newline at end of file From 7d4f24877773ecfefb83c42def511dc2eb8c1f18 Mon Sep 17 00:00:00 2001 From: Fabio Fernandes Date: Sun, 14 Jul 2013 16:51:11 -0300 Subject: [PATCH 2/2] Fixed Regex. --- plugins/droplr/droplr.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/droplr/droplr.rb b/plugins/droplr/droplr.rb index 4af49906d..38751dfcb 100755 --- a/plugins/droplr/droplr.rb +++ b/plugins/droplr/droplr.rb @@ -18,7 +18,7 @@ if ARGV[0].nil? exit!(1) end -if ARGV[0][%r{^http?://|https://}i] +if ARGV[0][%r{^http[|s]://}i] `osascript -e 'tell app "Droplr" to shorten "#{ARGV[0]}"'` else `open -ga /Applications/Droplr.app "#{ARGV[0]}"`