unset dir ax_common ax_common_sourced
function Usage {
- echo "$NAME <command> [...]"
+ echo "Usage: $NAME <command> [...]"
echo
echo " enable-plugin <name|directory> [<name|directory> [...]]"
echo " Enable plugin(s)."
echo " enable-default-plugins"
echo " Enable all default plugins."
echo
+ echo " set-theme <name>|-"
+ echo " Set active theme to <name>, or to the default."
+ echo
+ echo " upgrade"
+ echo " Upgrade AX-ZSH installation (requires Git)."
+ echo
exit 2
}
"$plugin:A"
"$AXZSH_PLUGIN_D/$plugin"
"$ZSH_CUSTOM/$plugin"
+ "$AXZSH/custom_plugins/$plugin"
"$AXZSH/plugins/$plugin"
"$AXZSH/default_plugins/$plugin"
"$AXZSH/core/$plugin"
return $?
}
+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
+ echo "Theme settings have been reset."
+ return 0
+ fi
+
+ if [ -r "$1" ]; then
+ theme="$1"
+ elif [ -r "$AXZSH/custom_themes/$1.axzshtheme" ]; then
+ theme="$AXZSH/custom_themes/$1.axzshtheme"
+ elif [ -r "$AXZSH/themes/$1.axzshtheme" ]; then
+ theme="$AXZSH/themes/$1.axzshtheme"
+ else
+ echo "Theme \"$1\" not found!"
+ return 1
+ fi
+ ln -sv "$theme" "$link_name" || return 1
+ return $?
+}
+
+function UpgradeAXZSH {
+ if [[ $+commands[git] -eq 0 ]]; then
+ ax_msg 2 "The git(1) command is not available!"
+ return 1
+ fi
+ if [[ ! -d "$AXZSH/.git" ]]; then
+ ax_msg 2 "AX-ZSH seems not to be installed using Git. Can't upgrade!"
+ return 1
+ fi
+
+ ax_msg - "Upgrading AX-ZSH in \"$AXZSH\" using git(1) ..."
+ ( cd "$AXZSH" && git pull --ff-only )
+}
+
NAME="$(basename "$0")"
[[ $# -gt 0 ]] || Usage
[[ $# -eq 0 ]] || Usage
EnableDefaultPlugins
;;
+ "set-theme")
+ [[ $# -eq 1 ]] || Usage
+ SetTheme "$1"
+ ;;
+ "upgrade")
+ [[ $# -eq 0 ]] || Usage
+ UpgradeAXZSH
+ ;;
*)
Usage
esac