From d1d06b5675bebbe54f3d876eb993b6e89d8963c7 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Wed, 5 Aug 2015 00:32:57 +0200 Subject: Use standard open command in current plugins Substitutes the current duplicate logic for the standard and cross-platform function open_command in plugins: frontend-search, jira, node, web-search --- plugins/frontend-search/frontend-search.plugin.zsh | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'plugins/frontend-search/frontend-search.plugin.zsh') diff --git a/plugins/frontend-search/frontend-search.plugin.zsh b/plugins/frontend-search/frontend-search.plugin.zsh index b9fb8634c..f7485621b 100644 --- a/plugins/frontend-search/frontend-search.plugin.zsh +++ b/plugins/frontend-search/frontend-search.plugin.zsh @@ -2,14 +2,6 @@ function frontend() { - # get the open command - local open_cmd - if [[ $(uname -s) == 'Darwin' ]]; then - open_cmd='open' - else - open_cmd='xdg-open' - fi - # no keyword provided, simply show how call methods if [[ $# -le 1 ]]; then echo "Please provide a search-content and a search-term for app.\nEx:\nfrontend \n" @@ -113,7 +105,7 @@ function frontend() { echo "$url" - $open_cmd "$url" + open_command "$url" } -- cgit v1.2.3-70-g09d2 From 0a80889848ccb3ada94dd2fdb793a01a268f7a16 Mon Sep 17 00:00:00 2001 From: Will Mendes Date: Sat, 29 Aug 2015 11:48:28 -0300 Subject: Frontend-search: add search in npm website --- plugins/frontend-search/README.md | 2 ++ plugins/frontend-search/_frontend-search.sh | 4 ++++ plugins/frontend-search/frontend-search.plugin.zsh | 7 ++++++- 3 files changed, 12 insertions(+), 1 deletion(-) (limited to 'plugins/frontend-search/frontend-search.plugin.zsh') diff --git a/plugins/frontend-search/README.md b/plugins/frontend-search/README.md index 801d450f3..b8e96ea4a 100644 --- a/plugins/frontend-search/README.md +++ b/plugins/frontend-search/README.md @@ -43,6 +43,7 @@ The search content are * `reactjs &as_sitesearch=facebook.github.io/react>` * `emberjs ` * `stackoverflow ` +* `npmjs ` ## Aliases ## @@ -69,6 +70,7 @@ There are a few aliases presented as well: * `reactjs` A shorthand for `frontend reactjs` * `emberjs` A shorthand for `frontend emberjs` * `stackoverflow` A shorthand for `frontend stackoverflow` +* `npmjs` A shorthand for `frontend npmjs` ## Author diff --git a/plugins/frontend-search/_frontend-search.sh b/plugins/frontend-search/_frontend-search.sh index 252f21570..b12f829a1 100644 --- a/plugins/frontend-search/_frontend-search.sh +++ b/plugins/frontend-search/_frontend-search.sh @@ -37,6 +37,7 @@ function _frontend() { 'reactjs: Search in React website' 'emberjs: Search in Ember website' 'stackoverflow: Search in StackOverflow website' + 'npmjs: Search in NPMJS website' ) _arguments -C \ @@ -110,6 +111,9 @@ function _frontend() { stackoverflow) _describe -t points "Warp points" frontend_points && ret=0 ;; + npmjs) + _describe -t points "Warp points" frontend_points && ret=0 + ;; esac ;; esac diff --git a/plugins/frontend-search/frontend-search.plugin.zsh b/plugins/frontend-search/frontend-search.plugin.zsh index f7485621b..e47735a60 100644 --- a/plugins/frontend-search/frontend-search.plugin.zsh +++ b/plugins/frontend-search/frontend-search.plugin.zsh @@ -9,7 +9,7 @@ function frontend() { fi # check whether the search engine is supported - if [[ ! $1 =~ '(jquery|mdn|compass|html5please|caniuse|aurajs|dartlang|qunit|fontello|bootsnipp|cssflow|codepen|unheap|bem|smacss|angularjs|reactjs|emberjs|stackoverflow)' ]]; + if [[ ! $1 =~ '(jquery|mdn|compass|html5please|caniuse|aurajs|dartlang|qunit|fontello|bootsnipp|cssflow|codepen|unheap|bem|smacss|angularjs|reactjs|emberjs|stackoverflow|npmjs)' ]]; then echo "Search valid search content $1 not supported." echo "Valid contents: (formats 'frontend ' or '')" @@ -33,6 +33,7 @@ function frontend() { echo "* reactjs" echo "* emberjs" echo "* stackoverflow" + echo "* npmjs" echo "" return 1 @@ -99,6 +100,9 @@ function frontend() { "stackoverflow") url="${url}stackoverflow.com" url="${url}/search?q=$2" ;; + "npmjs") + url="${url}www.npmjs.com" + url="${url}/search?q=$2" ;; *) echo "INVALID PARAM!" return ;; esac @@ -148,3 +152,4 @@ alias emberjs='frontend emberjs' # search websites alias stackoverflow='frontend stackoverflow' +alias npmjs='frontend npmjs' -- cgit v1.2.3-70-g09d2