2021-06-07 00:28:55 -04:00
|
|
|
#!/bin/sh
|
2021-03-18 21:42:44 -04:00
|
|
|
|
2021-08-02 22:23:20 -04:00
|
|
|
RED='\033[0;31m'
|
|
|
|
GREEN='\033[0;32m'
|
|
|
|
ORANGE='\033[0;33m'
|
|
|
|
BLUE='\033[0;34m'
|
|
|
|
NC='\033[0m' # No Color
|
|
|
|
|
|
|
|
# https://stackoverflow.com/questions/5947742/how-to-change-the-output-color-of-echo-in-linux
|
|
|
|
prompt() {
|
|
|
|
case ${1} in
|
|
|
|
"-s" | "--success")
|
|
|
|
printf "${GREEN}%s${NC}\n" "${2}"
|
|
|
|
;;
|
|
|
|
"-e" | "--error")
|
|
|
|
printf "${RED}%s${NC}\n" "${2}"
|
|
|
|
;;
|
|
|
|
"-w" | "--warning")
|
|
|
|
printf "${ORANGE}%s${NC}\n" "${2}"
|
|
|
|
;;
|
|
|
|
"-i" | "--info")
|
|
|
|
printf "${BLUE}%s${NC}\n" "${2}"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
printf "${GREEN}%s${NC}\n" "${2}"
|
|
|
|
;;
|
|
|
|
esac
|
2021-07-03 00:13:42 -04:00
|
|
|
}
|
2021-03-26 22:50:15 -04:00
|
|
|
|
2021-08-02 22:23:20 -04:00
|
|
|
_usage() {
|
|
|
|
printf "%s" \
|
|
|
|
"Usage: sh ${0##*/} [ options ]
|
|
|
|
-h | --help => Show this help.
|
|
|
|
-i | --install => Install the config.
|
|
|
|
-r | --remove => Remove the config.
|
|
|
|
-u | --update => Update the existing config without removing existing stuff.
|
|
|
|
"
|
|
|
|
exit 0
|
2021-07-09 04:54:42 -04:00
|
|
|
}
|
|
|
|
|
2021-08-02 22:23:20 -04:00
|
|
|
_eval_exit() {
|
|
|
|
status=$1
|
|
|
|
suc_msg=$2
|
|
|
|
err_msg=$3
|
|
|
|
|
|
|
|
case $status in
|
|
|
|
0)
|
|
|
|
prompt -s "${suc_msg}"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
prompt -e "${err_msg}"
|
|
|
|
;;
|
2021-07-09 04:54:42 -04:00
|
|
|
esac
|
|
|
|
|
2021-08-02 22:23:20 -04:00
|
|
|
}
|
2021-07-09 04:54:42 -04:00
|
|
|
|
2021-08-02 22:23:20 -04:00
|
|
|
# _install() {}
|
|
|
|
_remove() {
|
|
|
|
prompt -i "-> Cleaning '$HOME/.config/nvim/'"
|
|
|
|
# rm -rf "$HOME/.config/nvim/"
|
2021-07-09 04:54:42 -04:00
|
|
|
|
2021-08-02 22:23:20 -04:00
|
|
|
prompt -i "-> Cleaning '$HOME/.local/share/nvim/'"
|
|
|
|
# rm -rf "$HOME./local/share/nvim/"
|
2021-07-09 04:54:42 -04:00
|
|
|
}
|
2021-08-02 22:23:20 -04:00
|
|
|
# _update() {}
|
2021-07-09 04:54:42 -04:00
|
|
|
|
|
|
|
main() {
|
2021-08-02 22:23:20 -04:00
|
|
|
while :; do
|
|
|
|
case $1 in
|
|
|
|
-h | -\? | --help)
|
|
|
|
_usage
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
-i | --install)
|
|
|
|
_install
|
|
|
|
;;
|
|
|
|
-r | --remove)
|
|
|
|
_remove
|
|
|
|
_eval_exit $? "Successfully removeed NvChad!" "Failed to remove NvChad"
|
|
|
|
;;
|
|
|
|
*) # Default case: No more options, so break out of the loop.
|
|
|
|
break
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|
2021-07-09 04:54:42 -04:00
|
|
|
|
2021-08-02 22:23:20 -04:00
|
|
|
}
|
2021-07-09 04:54:42 -04:00
|
|
|
|
2021-08-02 22:23:20 -04:00
|
|
|
init() {
|
|
|
|
if [ $# -eq 0 ]; then
|
|
|
|
prompt -e "ERROR: This script needs at least one argument"
|
2021-07-09 04:54:42 -04:00
|
|
|
else
|
2021-08-02 22:23:20 -04:00
|
|
|
main "${@}"
|
2021-07-09 04:54:42 -04:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2021-08-02 22:23:20 -04:00
|
|
|
init "${@}"
|