summaryrefslogtreecommitdiff
path: root/plugins/droplr/droplr.plugin.zsh
diff options
context:
space:
mode:
authorMarc Cornellà <marc.cornella@live.com>2016-09-02 21:01:31 +0200
committerMarc Cornellà <marc.cornella@live.com>2016-09-02 21:03:49 +0200
commit7a32a98ced7817c4c4f178cb80c2c39d4957ea59 (patch)
treeaab54f3270357df69920dee9337033c7939e420d /plugins/droplr/droplr.plugin.zsh
parent864887388758b615d15a3f30a461aff1a7711d0b (diff)
downloadzsh-7a32a98ced7817c4c4f178cb80c2c39d4957ea59.tar.gz
zsh-7a32a98ced7817c4c4f178cb80c2c39d4957ea59.tar.bz2
zsh-7a32a98ced7817c4c4f178cb80c2c39d4957ea59.zip
droplr: convert ruby file into zsh
Diffstat (limited to 'plugins/droplr/droplr.plugin.zsh')
-rw-r--r--plugins/droplr/droplr.plugin.zsh16
1 files changed, 15 insertions, 1 deletions
diff --git a/plugins/droplr/droplr.plugin.zsh b/plugins/droplr/droplr.plugin.zsh
index 2a2ec227c..296a8b98b 100644
--- a/plugins/droplr/droplr.plugin.zsh
+++ b/plugins/droplr/droplr.plugin.zsh
@@ -1 +1,15 @@
-alias droplr=$ZSH/plugins/droplr/droplr.rb
+# Only compatible with MacOS
+[[ "$OSTYPE" == darwin* ]] || return
+
+droplr() {
+ if [[ $# -eq 0 ]]; then
+ echo You need to specify a parameter. >&2
+ return 1
+ fi
+
+ if [[ "$1" =~ ^http[|s]:// ]]; then
+ osascript -e "tell app 'Droplr' to shorten '$1'"
+ else
+ open -ga /Applications/Droplr.app "$1"
+ fi
+}