f642fcecaf66bb041ff66ad9430eff151bc4e6d6
- Author
- Marc Cornellà <marc.cornella@live.com>
- Committer
- Marc Cornellà <marc.cornella@live.com>
- Date
Message
Merge branch 'add-droplr-plugin'
Closes #1972.
Diff
1diff --git a/plugins/droplr/README.md b/plugins/droplr/README.md
2new file mode 100644
3index 0000000000000000000000000000000000000000..cfbec25edaa372e4342fc3c30e22923ff0297930
4--- /dev/null
5+++ b/plugins/droplr/README.md
6@@ -0,0 +1,19 @@
7+# droplr
8+
9+Use [Droplr](https://droplr.com/) from the comand line to upload files and shorten
10+links. It needs to have [Droplr.app](https://droplr.com/apps) installed and logged
11+in. MacOS only.
12+
13+To use it, add `droplr` to the `$plugins` variable in your zshrc file:
14+
15+```zsh
16+plugins=(... droplr)
17+```
18+
19+Author: [Fabio Fernandes](https://github.com/fabiofl)
20+
21+## Examples
22+
23+- Upload a file: `droplr ./path/to/file/`
24+
25+- Shorten a link: `droplr http://example.com`
26diff --git a/plugins/droplr/droplr.plugin.zsh b/plugins/droplr/droplr.plugin.zsh
27new file mode 100644
28index 0000000000000000000000000000000000000000..296a8b98b00328294571b012df369e581206316e
29--- /dev/null
30+++ b/plugins/droplr/droplr.plugin.zsh
31@@ -0,0 +1,15 @@
32+# Only compatible with MacOS
33+[[ "$OSTYPE" == darwin* ]] || return
34+
35+droplr() {
36+ if [[ $# -eq 0 ]]; then
37+ echo You need to specify a parameter. >&2
38+ return 1
39+ fi
40+
41+ if [[ "$1" =~ ^http[|s]:// ]]; then
42+ osascript -e "tell app 'Droplr' to shorten '$1'"
43+ else
44+ open -ga /Applications/Droplr.app "$1"
45+ fi
46+}