7a32a98ced7817c4c4f178cb80c2c39d4957ea59
- Author
- Marc Cornellà <marc.cornella@live.com>
- Committer
- Marc Cornellà <marc.cornella@live.com>
- Date
Message
droplr: convert ruby file into zsh
Diff
1diff --git a/plugins/droplr/droplr.plugin.zsh b/plugins/droplr/droplr.plugin.zsh
2index 2a2ec227c288df296476479d3329049bccca33f1..296a8b98b00328294571b012df369e581206316e 100644
3--- a/plugins/droplr/droplr.plugin.zsh
4+++ b/plugins/droplr/droplr.plugin.zsh
5@@ -1 +1,15 @@
6-alias droplr=$ZSH/plugins/droplr/droplr.rb
7+# Only compatible with MacOS
8+[[ "$OSTYPE" == darwin* ]] || return
9+
10+droplr() {
11+ if [[ $# -eq 0 ]]; then
12+ echo You need to specify a parameter. >&2
13+ return 1
14+ fi
15+
16+ if [[ "$1" =~ ^http[|s]:// ]]; then
17+ osascript -e "tell app 'Droplr' to shorten '$1'"
18+ else
19+ open -ga /Applications/Droplr.app "$1"
20+ fi
21+}
22diff --git a/plugins/droplr/droplr.rb b/plugins/droplr/droplr.rb
23deleted file mode 100755
24index 00300198e1a0ae85a36e4cb682684fe2329e41d2..0000000000000000000000000000000000000000
25--- a/plugins/droplr/droplr.rb
26+++ /dev/null
27@@ -1,12 +0,0 @@
28-#!/usr/bin/env ruby
29-
30-if ARGV[0].nil?
31- puts "You need to specify a parameter."
32- exit!(1)
33-end
34-
35-if ARGV[0][%r{^http[|s]://}i]
36- `osascript -e 'tell app "Droplr" to shorten "#{ARGV[0]}"'`
37-else
38- `open -ga /Applications/Droplr.app "#{ARGV[0]}"`
39-end