From 4b65f439e2c92b7c839dd355f8701d72f3a8ea2b Mon Sep 17 00:00:00 2001 From: Michael C Date: Sun, 6 Oct 2019 15:33:06 +0200 Subject: docs: add README.md for Dash plugin --- plugins/dash/README.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 plugins/dash/README.md (limited to 'plugins/dash') diff --git a/plugins/dash/README.md b/plugins/dash/README.md new file mode 100644 index 000000000..f69f834f3 --- /dev/null +++ b/plugins/dash/README.md @@ -0,0 +1,29 @@ +# Dash plugin + +This plugin adds command line functionality for [Dash](https://kapeli.com/dash), +an API Documentation Browser. + +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) +``` + +Make sure to source your rc file: +``` +source ~/.zshrc +``` + +## Usage + +Open and switch to the dash application. +``` +dash +``` + +Query for something in dash app. +``` +dash golang +``` -- cgit v1.2.3-70-g09d2 From 357336bfb399ac95db21ceed40dc7b18eea6779c Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Mon, 7 Oct 2019 17:04:31 +0200 Subject: Remove redundant section and document keyword args --- plugins/dash/README.md | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'plugins/dash') diff --git a/plugins/dash/README.md b/plugins/dash/README.md index f69f834f3..0ca3e4e44 100644 --- a/plugins/dash/README.md +++ b/plugins/dash/README.md @@ -1,9 +1,8 @@ # Dash plugin This plugin adds command line functionality for [Dash](https://kapeli.com/dash), -an API Documentation Browser. - -This plugin requires Dash to be installed to work. +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: @@ -11,19 +10,19 @@ To use it, add `dash` to the plugins array in your zshrc file: plugins=(... dash) ``` -Make sure to source your rc file: -``` -source ~/.zshrc -``` - ## Usage -Open and switch to the dash application. +- Open and switch to the dash application. ``` dash ``` -Query for something in dash app. +- Query for something in dash app: `dash query` +``` +dash golang +``` + +- You can optionally provide a keyword: `dash [keyword:]query` ``` -dash golang +dash python:tuple ``` -- cgit v1.2.3-70-g09d2 From b45e0f4836d7b2a3b5fe2266d669d878ccd737e7 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Mon, 7 Oct 2019 17:08:38 +0200 Subject: dash: simplify completion logic --- plugins/dash/dash.plugin.zsh | 52 ++++++++++++++++++++------------------------ 1 file changed, 23 insertions(+), 29 deletions(-) (limited to 'plugins/dash') 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 -- cgit v1.2.3-70-g09d2