Browse Source

style(acs): fix style and gitignore __pycache__ folder

Marc Cornellà 2 years ago
parent
commit
c4be9294f2
2 changed files with 6 additions and 4 deletions
  1. 1 0
      plugins/aliases/.gitignore
  2. 5 4
      plugins/aliases/aliases.plugin.zsh

+ 1 - 0
plugins/aliases/.gitignore

@@ -0,0 +1 @@
+__pycache__

+ 5 - 4
plugins/aliases/aliases.plugin.zsh

@@ -2,9 +2,10 @@
 #
 # - acs: alias cheatsheet
 #   group alias by command, pass addition argv to grep.
-ALIASES_PLUGIN_ROOT=$(cd `dirname $0` && pwd)
 function acs(){
-    which python >>/dev/null
-    [[ $? -eq 1 ]] && echo "[error]no python executable detected!" && return
-    alias | python $ALIASES_PLUGIN_ROOT/cheatsheet.py $@
+  (( $+commands[python] )) || {
+    echo "[error] No python executable detected"
+    return
+  }
+  alias | python ${functions_source[$0]:h}/cheatsheet.py $@
 }