]> arthur.barton.de Git - ax-zsh.git/commitdiff
axzshctl set-theme: Don't remove theme link first
authorAlexander Barton <alex@barton.de>
Sun, 3 Feb 2019 15:36:47 +0000 (16:36 +0100)
committerAlexander Barton <alex@barton.de>
Sun, 3 Feb 2019 15:36:47 +0000 (16:36 +0100)
Force creating the symlink, overwriting a possibly already existing one.
This prevents us from having no theme link at all, if something goes
wrong ;-)

bin/axzshctl

index 70c9affe94a8e3783003aa7de8dd30d559ae9cd2..5915dd468aa95446e9b033b953d4c1db3a5bac87 100755 (executable)
@@ -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
@@ -228,7 +222,7 @@ function SetTheme {
                        return 1
                fi
        fi
-       ln -sv "$theme" "$link_name" || return 1
+       ln -fsv "$theme" "$link_name" || return 1
        return $?
 }