]> arthur.barton.de Git - ax-zsh.git/blobdiff - bin/axzshctl
axzshctl check-plugins: Enhance output
[ax-zsh.git] / bin / axzshctl
index c25fb442a00360177a40be854b758298fdbf22fd..34d198ec9153f33dc42ab70c72f279fadc229ff1 100755 (executable)
@@ -79,7 +79,7 @@ function UpdatePluginCache {
                $AXZSH/cache/zshrc.cache \
                || return 1
        echo "Regenerating cache files ..."
-       zsh -ilc '' >/dev/null
+       AXZSH_PLUGIN_CHECK=1 zsh -ilc '' >/dev/null
 }
 
 function NormalizedPluginName {
@@ -325,24 +325,27 @@ function CheckPlugins {
        invalid_plugins=()
 
        ax_msg - "Checking plugins ..."
-       for dir ($AXZSH/plugins/*(N)); do
+       for dir ($AXZSH/plugins/[a-z0-9]*(N)); do
                plugin=${dir:t}
 
                # Test if plugin is already enabled
-               [[ -e "$AXZSH/active_plugins/$plugin" ]] \
-                       && enabled=" (enabled)" \
-                       || unset enabled
+               if [[ -e "$AXZSH/active_plugins/$plugin" ]]; then
+                       printf ' \e[1;32m+\e[m "\e[1m%s\e[m" ... ' "${plugin}"
+                       enabled=1
+               else
+                       printf ' \e[1;31m-\e[m "%s" ... ' "${plugin}"
+                       unset enabled
+               fi
 
                # Test plugin ...
-               printf " - \"%s\"%s ... " "$plugin" "$enabled"
                new_plugin=""
-               for script ($AXZSH/plugins/$plugin/$plugin.{zshrc,zprofile}); do
+               for script ($AXZSH/plugins/$plugin/$plugin.{zshrc,zprofile,ax-io}); do
                        [[ -r "$script" ]] || continue
                        AXZSH_PLUGIN_CHECK=1 zsh -i -c "source $script"; r=$?
                        if [[ $r -eq 0 ]]; then
                                new_plugin=$plugin
-                               break
                        fi
+                       break
                done
                if [[ -n "$new_plugin" ]]; then
                        detected_plugins+=($new_plugin)
@@ -354,7 +357,7 @@ function CheckPlugins {
                        ax_msg 1 "optional."
                else
                        [[ -n "$enabled" ]] && invalid_plugins+=($plugin)
-                       ax_msg 2 "failed."
+                       ax_msg 2 "failed ($r)."
                fi
        done
        echo