]> arthur.barton.de Git - ax-zsh.git/blobdiff - bin/axzshctl
11_terminal: "cygwin" is a modern terminal
[ax-zsh.git] / bin / axzshctl
index d2216bbe566d01df133d5376f8df7a3d220abafa..8298743a5a13bce228e173dccc16f34fb30c7443 100755 (executable)
@@ -23,22 +23,20 @@ function Usage {
        echo
        echo "  enable"
        echo "    Enable AX-ZSH altogether."
-       echo
        echo "  disable"
        echo "    Disable AX-ZSH altogether."
        echo
        echo "  enable-plugin <name|directory> [<name|directory> [...]]"
        echo "    Enable plugin(s)."
-       echo
        echo "  disable-plugin <name> [<name> [...]]"
        echo "    Disable plugin(s)."
+       echo "  list-enabled"
+       echo "    List enabled plugins."
        echo
        echo "  reset-plugins"
        echo "    Reset active plugins to the default set."
-       echo
        echo "  enable-default-plugins"
        echo "    Enable all default plugins."
-       echo
        echo "  check-plugins"
        echo "    Detect plugins which are \"useful\" on this system."
        echo
@@ -53,9 +51,9 @@ function Usage {
 
 function NormalizedPluginName {
        if [[ "$1" =~ "^[[:alnum:]-]+/[[:alnum:]_-]+$" ]]; then
-               echo "$1" | sed -e 's|/|#|g'
+               echo "${1:gs/\//#}"
        elif [[ "$1" =~ "/" ]]; then
-               basename "$1"
+               echo "${1:t}"
        else
                echo "$1"
        fi
@@ -136,6 +134,13 @@ function DisablePlugin {
        return $r
 }
 
+function ListEnabledPlugins {
+       for plugin ($AXZSH/active_plugins/*(N)); do
+               print ${plugin:t:s/#/\//}
+       done
+       return 0
+}
+
 function ResetPlugins {
        local dir="$AXZSH/active_plugins"
        local r1=0, r2=0
@@ -213,7 +218,7 @@ function UpgradeForeignPlugins {
        fi
 
        for dir ($AXZSH/repos/*(N)); do
-               name=$(basename "$dir" | sed -e 's|#|/|g')
+               name=${dir:t:s/#/\//}
                if [ -d "$dir/.git" ]; then
                        ax_msg - "Upgrading \"$name\" [git] ..."
                        (
@@ -232,7 +237,7 @@ function CheckPlugins {
 
        ax_msg - "Checking plugins ..."
        for dir ($AXZSH/plugins/*(N)); do
-               plugin=$(basename "$dir")
+               plugin=${dir:t}
 
                # Test if plugin is already enabled
                [[ -e "$AXZSH/active_plugins/$plugin" ]] \
@@ -323,6 +328,10 @@ case "$cmd" in
                        DisablePlugin "$plugin"
                done
                ;;
+       "list-enabled")
+               [[ $# -eq 0 ]] || Usage
+               ListEnabledPlugins
+               ;;
        "reset-plugins")
                [[ $# -eq 0 ]] || Usage
                ResetPlugins