67cc59b4258a13232cddfddd75f44d8ca2b80172

Author
Marc Cornellà <hello@mcornella.com>
Committer
Marc Cornellà <hello@mcornella.com>
Date

Message

style: some code style fixes

Diff

  1diff --git a/plugins/frontend-search/frontend-search.plugin.zsh b/plugins/frontend-search/frontend-search.plugin.zsh
  2index 437e477b90dac85be88b51dffb87b7362d83b026..7f8d5c90c0e28a8c1ac26e219fc228ccc0c13dc9 100644
  3--- a/plugins/frontend-search/frontend-search.plugin.zsh
  4+++ b/plugins/frontend-search/frontend-search.plugin.zsh
  5@@ -39,7 +39,7 @@ function frontend() {
  6   emulate -L zsh
  7 
  8   # define search context URLS
  9-  typeset -A urls
 10+  local -A urls
 11   urls=(
 12     angular        'https://angular.io/?search='
 13     angularjs      $(_frontend_fallback 'angularjs.org')
 14@@ -73,25 +73,23 @@ function frontend() {
 15   )
 16 
 17   # show help for command list
 18-  if [[ $# -lt 2 ]]
 19-  then
 20-      print -P "Usage: frontend %Ucontext%u %Uterm%u [...%Umore%u] (or just: %Ucontext%u %Uterm%u [...%Umore%u])"
 21-      print -P ""
 22-      print -P "%Uterm%u and what follows is what will be searched for in the %Ucontext%u website,"
 23-      print -P "and %Ucontext%u is one of the following:"
 24-      print -P ""
 25-      print -P "  angular, angularjs, bem, bootsnipp, caniuse, codepen, compassdoc, cssflow, packagephobia"
 26-      print -P "  dartlang, emberjs, fontello, flowtype, github, html5please, jestjs, jquery, lodash,"
 27-      print -P "  mdn, npmjs, nodejs, qunit, reactjs, smacss, stackoverflow, unheap, vuejs, bundlephobia"
 28-      print -P ""
 29-      print -P "For example: frontend npmjs mocha (or just: npmjs mocha)."
 30-      print -P ""
 31-      return 1
 32+  if [[ $# -lt 2 ]]; then
 33+    print -P "Usage: frontend %Ucontext%u %Uterm%u [...%Umore%u] (or just: %Ucontext%u %Uterm%u [...%Umore%u])"
 34+    print -P ""
 35+    print -P "%Uterm%u and what follows is what will be searched for in the %Ucontext%u website,"
 36+    print -P "and %Ucontext%u is one of the following:"
 37+    print -P ""
 38+    print -P "  angular, angularjs, bem, bootsnipp, caniuse, codepen, compassdoc, cssflow, packagephobia"
 39+    print -P "  dartlang, emberjs, fontello, flowtype, github, html5please, jestjs, jquery, lodash,"
 40+    print -P "  mdn, npmjs, nodejs, qunit, reactjs, smacss, stackoverflow, unheap, vuejs, bundlephobia"
 41+    print -P ""
 42+    print -P "For example: frontend npmjs mocha (or just: npmjs mocha)."
 43+    print -P ""
 44+    return 1
 45   fi
 46 
 47   # check whether the search context is supported
 48-  if [[ -z "$urls[$1]" ]]
 49-  then
 50+  if [[ -z "$urls[$1]" ]]; then
 51     echo "Search context \"$1\" currently not supported."
 52     echo ""
 53     echo "Valid contexts are:"
 54diff --git a/plugins/pj/pj.plugin.zsh b/plugins/pj/pj.plugin.zsh
 55index e36d49204f4e9f8a13c160cca601c37d2a190943..431576f4bad0d5d7ac7476789f8ba9ff63ea51eb 100644
 56--- a/plugins/pj/pj.plugin.zsh
 57+++ b/plugins/pj/pj.plugin.zsh
 58@@ -1,37 +1,34 @@
 59 alias pjo="pj open"
 60 
 61-pj () {
 62-    emulate -L zsh
 63-
 64-    cmd="cd"
 65-    project=$1
 66-
 67-    if [[ "open" == "$project" ]]; then
 68-        shift
 69-        project=$*
 70-        cmd=${=EDITOR}
 71-    else
 72-        project=$*
 73+function pj() {
 74+  local cmd="cd"
 75+  local project="$1"
 76+
 77+  if [[ "open" == "$project" ]]; then
 78+    shift
 79+    project=$*
 80+    cmd=${=EDITOR}
 81+  else
 82+    project=$*
 83+  fi
 84+
 85+  for basedir ($PROJECT_PATHS); do
 86+    if [[ -d "$basedir/$project" ]]; then
 87+      $cmd "$basedir/$project"
 88+      return
 89     fi
 90+  done
 91 
 92-    for basedir ($PROJECT_PATHS); do
 93-        if [[ -d "$basedir/$project" ]]; then
 94-            $cmd "$basedir/$project"
 95-            return
 96-        fi
 97-    done
 98-
 99-    echo "No such project '${project}'."
100+  echo "No such project '${project}'."
101 }
102 
103 _pj () {
104-    emulate -L zsh
105+  local -a projects
106+  for basedir ($PROJECT_PATHS); do
107+    projects+=(${basedir}/*(/N))
108+  done
109 
110-    typeset -a projects
111-    for basedir ($PROJECT_PATHS); do
112-        projects+=(${basedir}/*(/N))
113-    done
114-
115-    compadd ${projects:t}
116+  compadd ${projects:t}
117 }
118+
119 compdef _pj pj