ff706f3ef8fd632d93e2c347d32c62f15b17c25c

Author
willmendesneto <willmendesneto@gmail.com>
Committer
Marc Cornellà <marc.cornella@live.com>
Date

Message

Add "help" method in "frontend-search" plugin

Diff

 1diff --git a/plugins/frontend-search/README.md b/plugins/frontend-search/README.md
 2index b8e96ea4a36770a7731b4c20e30221a43594bc7a..bf8a4bc0839bb9d1b98268ac7df735db3d1a15a7 100644
 3--- a/plugins/frontend-search/README.md
 4+++ b/plugins/frontend-search/README.md
 5@@ -17,9 +17,16 @@ plugins=( <your-plugins-list>... frontend-search)
 6 
 7 ## Commands ##
 8 
 9-All command searches are accept only in format
10+All command searches are accept only in formats
11 
12 * `frontend <search-content> <search-term>`
13+* `<search-content> <search-term>`
14+
15+For more informations, please run help command (are similars)
16+
17+* `frontend -h`
18+* `frontend --help`
19+* `frontend help`
20 
21 The search content are
22 
23diff --git a/plugins/frontend-search/frontend-search.plugin.zsh b/plugins/frontend-search/frontend-search.plugin.zsh
24index 3afc3336d4f96cde64b7c119a9cb0853096b2839..08930ddcda5ed2728b737e084c9d76b8863219a2 100644
25--- a/plugins/frontend-search/frontend-search.plugin.zsh
26+++ b/plugins/frontend-search/frontend-search.plugin.zsh
27@@ -29,14 +29,36 @@ function frontend() {
28     unheap         'http://www.unheap.com/?s='
29   )
30 
31+  # show help for commands list
32+  if [[ $1 =~ '(help|--help|-h)' ]]
33+  then
34+      echo "Usage:"
35+      echo "\n\tfrontend <search-content>\n\t<search-content>\n\tfrontend <search-content> <search-term>"
36+      echo ""
37+      echo "Where <search-content> is one of:"
38+      echo "jquery, mdn, compass, html5please, caniuse, aurajs, dartlang, qunit, fontello,"
39+      echo "bootsnipp, cssflow, codepen, unheap, bem, smacss, angularjs, reactjs, emberjs"
40+      echo "help"
41+      echo ""
42+      echo "Where <search-term> is a term to search in allowed repositories"
43+      echo ""
44+      echo "frontend --help       show plugin help"
45+      echo "frontend -h           show plugin help"
46+      echo ""
47+      echo "It is allowed to directly access all search contents."
48+      echo ""
49+      return 1
50+  fi
51+
52   # no keyword provided, simply show how call methods
53-  if [[ $# -le 1 ]]; then
54+  if [[ $# -le 1 ]]
55+  then
56     echo "Please provide a search-content and a search-term for app.\nEx:\nfrontend <search-content> <search-term>\n"
57     return 1
58   fi
59 
60   # check whether the search engine is supported
61-  if [[ -z "$urls[$1]" ]]; then
62+  if [[ -z "$urls[$1]" ]]
63   then
64     echo "Search valid search content $1 not supported."
65     echo "Valid contents: (formats 'frontend <search-content>' or '<search-content>')"