]> arthur.barton.de Git - ax-zsh.git/commitdiff
axzshctl: Make more use of ZSH variable modifiers
authorAlexander Barton <alex@barton.de>
Wed, 26 Oct 2016 08:37:43 +0000 (10:37 +0200)
committerAlexander Barton <alex@barton.de>
Wed, 26 Oct 2016 08:37:43 +0000 (10:37 +0200)
bin/axzshctl

index d2216bbe566d01df133d5376f8df7a3d220abafa..b5dfb7244e32d288d666854e42d247ba559c0c54 100755 (executable)
@@ -53,9 +53,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
@@ -213,7 +213,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 +232,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" ]] \