|
|
@ -22,7 +22,6 @@ get_path() { ( |
|
|
|
return 1 |
|
|
|
) } |
|
|
|
|
|
|
|
ANSI_ESC=$'\e[' |
|
|
|
|
|
|
|
ansi_color() { |
|
|
|
local choice="$1" |
|
|
@ -35,22 +34,9 @@ ansi_color() { |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
if [ "$choice" != "no" ]; then |
|
|
|
|
|
|
|
SET_COL_CHAR="${ANSI_ESC}${COL_CHAR}G" |
|
|
|
SET_COL_STATUS="${ANSI_ESC}${COL_STATUS}G" |
|
|
|
SET_COL_INFO="${ANSI_ESC}${COL_INFO}G" |
|
|
|
SET_COL_ELT="${ANSI_ESC}${COL_ELT}G" |
|
|
|
|
|
|
|
SET_BEGINCOL="${ANSI_ESC}0G" |
|
|
|
ANSI_ESC=$'\e[' |
|
|
|
|
|
|
|
UP="${ANSI_ESC}1A" |
|
|
|
DOWN="${ANSI_ESC}1B" |
|
|
|
LEFT="${ANSI_ESC}1D" |
|
|
|
RIGHT="${ANSI_ESC}1C" |
|
|
|
|
|
|
|
SAVE="${ANSI_ESC}7" |
|
|
|
RESTORE="${ANSI_ESC}8" |
|
|
|
if [ "$choice" != "no" ]; then |
|
|
|
|
|
|
|
NORMAL="${ANSI_ESC}0m" |
|
|
|
|
|
|
@ -71,57 +57,14 @@ ansi_color() { |
|
|
|
DARKPINK="${ANSI_ESC}0;35m" |
|
|
|
DARKCYAN="${ANSI_ESC}0;36m" |
|
|
|
DARKWHITE="${ANSI_ESC}0;37m" |
|
|
|
|
|
|
|
SUCCESS=$GREEN |
|
|
|
WARNING=$YELLOW |
|
|
|
FAILURE=$RED |
|
|
|
NOOP=$BLUE |
|
|
|
ON=$SUCCESS |
|
|
|
OFF=$FAILURE |
|
|
|
ERROR=$FAILURE |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
SET_COL_CHAR= |
|
|
|
SET_COL_STATUS= |
|
|
|
SET_COL_INFO= |
|
|
|
SET_COL_ELT= |
|
|
|
|
|
|
|
SET_BEGINCOL= |
|
|
|
|
|
|
|
NORMAL= |
|
|
|
RED= |
|
|
|
GREEN= |
|
|
|
YELLOW= |
|
|
|
BLUE= |
|
|
|
GRAY= |
|
|
|
WHITE= |
|
|
|
|
|
|
|
DARKGRAY= |
|
|
|
DARKRED= |
|
|
|
DARKGREEN= |
|
|
|
DARKYELLOW= |
|
|
|
DARKBLUE= |
|
|
|
DARKPINK= |
|
|
|
DARKCYAN= |
|
|
|
|
|
|
|
SUCCESS= |
|
|
|
WARNING= |
|
|
|
FAILURE= |
|
|
|
NOOP= |
|
|
|
ON= |
|
|
|
OFF= |
|
|
|
ERROR= |
|
|
|
|
|
|
|
fi |
|
|
|
|
|
|
|
ansi_color="$choice" |
|
|
|
|
|
|
|
export SET_COL_CHAR SET_COL_STATUS SET_COL_INFO SET_COL_ELT \ |
|
|
|
SET_BEGINCOL UP DOWN LEFT RIGHT SAVE RESTORE NORMAL \ |
|
|
|
export NORMAL \ |
|
|
|
GRAY RED GREEN YELLOW BLUE PINK CYAN WHITE DARKGRAY \ |
|
|
|
DARKRED DARKGREEN DARKYELLOW DARKBLUE DARKPINK DARKCYAN \ |
|
|
|
SUCCESS WARNING FAILURE NOOP ON OFF ERROR ansi_color |
|
|
|
ansi_color |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -175,8 +118,10 @@ OS=$(get_os) || { |
|
|
|
exit 1 |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fn.exists() { declare -F "$1" >/dev/null; } |
|
|
|
|
|
|
|
|
|
|
|
## copy stdin to file, archive previous existing file if any |
|
|
|
install_file() { |
|
|
|
local path="$1" tmpfile |
|
|
@ -203,6 +148,7 @@ install_file() { |
|
|
|
rm -f "$tmpfile" |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
get_charm_store() { |
|
|
|
if ! [ -d "$CHARM_PATH" ]; then |
|
|
|
echo "Creating charm-store in '$CHARM_PATH'." |
|
|
@ -337,7 +283,6 @@ install.wsl2() { |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
run() { |
|
|
|
OS="$(get_os)" |
|
|
|
if fn.exists "install.$OS"; then |
|
|
@ -347,5 +292,11 @@ run() { |
|
|
|
fi |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
## |
|
|
|
## Code |
|
|
|
## |
|
|
|
|
|
|
|
|
|
|
|
ansi_color tty |
|
|
|
run |