summaryrefslogtreecommitdiff
path: root/plugins/dash
diff options
context:
space:
mode:
authorTuowen Zhao <ztuowen@gmail.com>2019-10-09 20:16:18 -0600
committerTuowen Zhao <ztuowen@gmail.com>2019-10-09 20:16:18 -0600
commit112a85697481cae663ff281b74fdc1f72a67b294 (patch)
treee7f6f938fda886c87d296711d853bcc9833b9ec2 /plugins/dash
parent09829ba30c269e35bddf44a21f3357efd31e686f (diff)
parent710a3d5a1e2888a4dfb1769f8f1edd8a590eee22 (diff)
downloadzsh-112a85697481cae663ff281b74fdc1f72a67b294.tar.gz
zsh-112a85697481cae663ff281b74fdc1f72a67b294.tar.bz2
zsh-112a85697481cae663ff281b74fdc1f72a67b294.zip
Merge branch 'master' of https://github.com/robbyrussell/oh-my-zsh
Diffstat (limited to 'plugins/dash')
-rw-r--r--plugins/dash/README.md28
-rw-r--r--plugins/dash/dash.plugin.zsh52
2 files changed, 51 insertions, 29 deletions
diff --git a/plugins/dash/README.md b/plugins/dash/README.md
new file mode 100644
index 000000000..0ca3e4e44
--- /dev/null
+++ b/plugins/dash/README.md
@@ -0,0 +1,28 @@
+# Dash plugin
+
+This plugin adds command line functionality for [Dash](https://kapeli.com/dash),
+an API Documentation Browser for macOS. This plugin requires Dash to be installed
+to work.
+
+To use it, add `dash` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... dash)
+```
+
+## Usage
+
+- Open and switch to the dash application.
+```
+dash
+```
+
+- Query for something in dash app: `dash query`
+```
+dash golang
+```
+
+- You can optionally provide a keyword: `dash [keyword:]query`
+```
+dash python:tuple
+```
diff --git a/plugins/dash/dash.plugin.zsh b/plugins/dash/dash.plugin.zsh
index b00d4877e..ace2e33c1 100644
--- a/plugins/dash/dash.plugin.zsh
+++ b/plugins/dash/dash.plugin.zsh
@@ -35,36 +35,30 @@ _dash() {
if [[ "$locator" == "platform" ]]; then
# Since these are the only special cases right now, let's not do the
# expensive processing unless we have to
- if [[ "$keyword" == "python" || "$keyword" == "java" || \
- "$keyword" == "qt" || "$keyword" == "cocs2d" ]]; then
+ if [[ "$keyword" = (python|java|qt|cocos2d) ]]; then
docsetName=`echo $doc | grep -Eo "docsetName = .*?;" | sed -e "s/docsetName = \(.*\);/\1/" -e "s/[\":]//g"`
- if [[ "$keyword" == "python" ]]; then
- if [[ "$docsetName" == "Python 2" ]]; then
- keyword="python2"
- elif [[ "$docsetName" == "Python 3" ]]; then
- keyword="python3"
- fi
- elif [[ "$keyword" == "java" ]]; then
- if [[ "$docsetName" == "Java SE7" ]]; then
- keyword="java7"
- elif [[ "$docsetName" == "Java SE6" ]]; then
- keyword="java6"
- elif [[ "$docsetName" == "Java SE8" ]]; then
- keyword="java8"
- fi
- elif [[ "$keyword" == "qt" ]]; then
- if [[ "$docsetName" == "Qt 5" ]]; then
- keyword="qt5"
- elif [[ "$docsetName" == "Qt 4" ]]; then
- keyword="qt4"
- elif [[ "$docsetName" == "Qt" ]]; then
- keyword="qt4"
- fi
- elif [[ "$keyword" == "cocos2d" ]]; then
- if [[ "$docsetName" == "Cocos3D" ]]; then
- keyword="cocos3d"
- fi
- fi
+ case "$keyword" in
+ python)
+ case "$docsetName" in
+ "Python 2") keyword="python2" ;;
+ "Python 3") keyword="python3" ;;
+ esac ;;
+ java)
+ case "$docsetName" in
+ "Java SE7") keyword="java7" ;;
+ "Java SE6") keyword="java6" ;;
+ "Java SE8") keyword="java8" ;;
+ esac ;;
+ qt)
+ case "$docsetName" in
+ "Qt 5") keyword="qt5" ;;
+ "Qt 4"|Qt) keyword="qt4" ;;
+ esac ;;
+ cocos2d)
+ case "$docsetName" in
+ Cocos3D) keyword="cocos3d" ;;
+ esac ;;
+ esac
fi
fi