]> arthur.barton.de Git - ax-zsh.git/blobdiff - bin/axzshctl
axzshctl: Look for themes in the "custom_themes" folder, too
[ax-zsh.git] / bin / axzshctl
index a75ebb3db750e0d483c1de6047bd4fd07d6ba3e4..32dd61a17577e83fd33f79faf33f235263eac478 100755 (executable)
@@ -10,7 +10,7 @@ for dir ("$HOME/lib" "$HOME/.ax" /usr/local /opt/ax /usr); do
        ax_common="${dir}/lib/ax/ax-common.sh"
        [[ -r "$ax_common" ]] && source "$ax_common"
 done
-if [[ -z "$ax_common_sourced" || axzsh_is_dumb_terminal ]]; then
+if [[ -z "$ax_common_sourced" ]]; then
        function ax_msg {
                shift
                echo "$@"
@@ -191,14 +191,8 @@ function EnableDefaultPlugins {
 function SetTheme {
        local link_name="$AXZSH/active_theme"
 
-       if [ $# -ne 1 ]; then
-               echo "Usage: axzsh_set_theme <name|->"
-               return 1
-       fi
-
-       rm -f "$link_name" || return 1
-
        if [ "$1" = "-" ]; then
+               rm -f "$link_name" || return 1
                echo "Theme settings have been reset."
                return 0
        fi
@@ -212,6 +206,7 @@ function SetTheme {
        else
                # Look for theme inside of installed plugins:
                for dname (
+                       "$AXZSH/custom_themes"
                        "$AXZSH/custom_plugins/"*(N)
                        "$AXZSH/repos/"*(N)
                ); do
@@ -228,7 +223,7 @@ function SetTheme {
                        return 1
                fi
        fi
-       ln -sv "$theme" "$link_name" || return 1
+       ln -fsv "$theme" "$link_name" || return 1
        return $?
 }
 
@@ -377,8 +372,7 @@ case "$cmd" in
                ;;
        "enable-default-plugins")
                [[ $# -eq 0 ]] || Usage
-               EnableDefaultPlugins
-               UpdatePluginCache
+               EnableDefaultPlugins && UpdatePluginCache
                ;;
        "check-plugins")
                [[ $# -eq 0 ]] || Usage
@@ -386,8 +380,7 @@ case "$cmd" in
                ;;
        "set-theme")
                [[ $# -eq 1 ]] || Usage
-               SetTheme "$1"
-               UpdatePluginCache
+               SetTheme "$1" && UpdatePluginCache
                ;;
        "upgrade")
                [[ $# -eq 0 ]] || Usage