From bc9e4aa3639e86d1702c00129b2ad88c48696654 Mon Sep 17 00:00:00 2001 From: Alexander Barton Date: Mon, 23 Nov 2020 00:28:54 +0100 Subject: [PATCH] axzshctl: Embed "ax-common" compatibility functions --- bin/axzshctl | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/bin/axzshctl b/bin/axzshctl index 34d198e..17cea90 100755 --- a/bin/axzshctl +++ b/bin/axzshctl @@ -4,22 +4,21 @@ # Copyright (c) 2015-2020 Alexander Barton # -# Include "ax-common.sh", if available: -for dir ("$HOME/lib" "$HOME/.ax" /usr/local /opt/ax /usr); do - [[ -z "$ax_common_sourced" ]] || break - ax_common="${dir}/lib/ax/ax-common.sh" - [[ -r "$ax_common" ]] && source "$ax_common" -done -if [[ -z "$ax_common_sourced" ]]; then - function ax_msg { - shift - echo "$@" - } - function ax_error { - ax_msg 2 "$@" >&2 - } -fi -unset dir ax_common ax_common_sourced +# Embedded ax-common compatibility functions ... +function ax_msg { + case "$1" in + "0") c="32"; ;; + "1") c="33"; ;; + "2") c="31"; ;; + "-") c="1"; ;; + *) c="0"; ;; + esac + shift + printf "\e[${c}m%s\e[0m\n" "$@" +} +function ax_error { + ax_msg 2 "$@" >&2 +} function Version { echo "ax-zsh -- Modular configuration system for the Z shell (ZSH)" -- 2.39.2