diff options
| author | willmendesneto <willmendesneto@gmail.com> | 2014-07-03 22:53:00 -0300 | 
|---|---|---|
| committer | Marc Cornellà <marc.cornella@live.com> | 2015-09-02 00:26:13 +0200 | 
| commit | ff706f3ef8fd632d93e2c347d32c62f15b17c25c (patch) | |
| tree | 20d87a5842c7e17e744eaecc0de99202909b0761 | |
| parent | f1472f1f6462d391a14ec80157365500f7a11b3f (diff) | |
| download | zsh-ff706f3ef8fd632d93e2c347d32c62f15b17c25c.tar.gz zsh-ff706f3ef8fd632d93e2c347d32c62f15b17c25c.tar.bz2 zsh-ff706f3ef8fd632d93e2c347d32c62f15b17c25c.zip | |
Add "help" method in "frontend-search" plugin
| -rw-r--r-- | plugins/frontend-search/README.md | 9 | ||||
| -rw-r--r-- | plugins/frontend-search/frontend-search.plugin.zsh | 26 | 
2 files changed, 32 insertions, 3 deletions
| diff --git a/plugins/frontend-search/README.md b/plugins/frontend-search/README.md index b8e96ea4a..bf8a4bc08 100644 --- a/plugins/frontend-search/README.md +++ b/plugins/frontend-search/README.md @@ -17,9 +17,16 @@ plugins=( <your-plugins-list>... frontend-search)  ## Commands ## -All command searches are accept only in format +All command searches are accept only in formats  * `frontend <search-content> <search-term>` +* `<search-content> <search-term>` + +For more informations, please run help command (are similars) + +* `frontend -h` +* `frontend --help` +* `frontend help`  The search content are diff --git a/plugins/frontend-search/frontend-search.plugin.zsh b/plugins/frontend-search/frontend-search.plugin.zsh index 3afc3336d..08930ddcd 100644 --- a/plugins/frontend-search/frontend-search.plugin.zsh +++ b/plugins/frontend-search/frontend-search.plugin.zsh @@ -29,14 +29,36 @@ function frontend() {      unheap         'http://www.unheap.com/?s='    ) +  # show help for commands list +  if [[ $1 =~ '(help|--help|-h)' ]] +  then +      echo "Usage:" +      echo "\n\tfrontend <search-content>\n\t<search-content>\n\tfrontend <search-content> <search-term>" +      echo "" +      echo "Where <search-content> is one of:" +      echo "jquery, mdn, compass, html5please, caniuse, aurajs, dartlang, qunit, fontello," +      echo "bootsnipp, cssflow, codepen, unheap, bem, smacss, angularjs, reactjs, emberjs" +      echo "help" +      echo "" +      echo "Where <search-term> is a term to search in allowed repositories" +      echo "" +      echo "frontend --help       show plugin help" +      echo "frontend -h           show plugin help" +      echo "" +      echo "It is allowed to directly access all search contents." +      echo "" +      return 1 +  fi +    # no keyword provided, simply show how call methods -  if [[ $# -le 1 ]]; then +  if [[ $# -le 1 ]] +  then      echo "Please provide a search-content and a search-term for app.\nEx:\nfrontend <search-content> <search-term>\n"      return 1    fi    # check whether the search engine is supported -  if [[ -z "$urls[$1]" ]]; then +  if [[ -z "$urls[$1]" ]]    then      echo "Search valid search content $1 not supported."      echo "Valid contents: (formats 'frontend <search-content>' or '<search-content>')" | 
