Skip to content

Commit d8784d4

Browse files
committed
uninstall: //echo/printf
- Alsö, add implementation note at top.
1 parent 80c10fb commit d8784d4

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

uninstall.sh

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
#!/usr/bin/env bash
2+
#
3+
# Since we're uninstalling, avoid depending on any other part of _Bash It_.
4+
# I.e., hard-code colors (avoid `lib/colors.bash`), &c.
5+
26
: "${BASH_IT:=${HOME?}/.bash_it}"
37

48
CONFIG_FILE=".bashrc"
@@ -10,21 +14,19 @@ fi
1014
BACKUP_FILE=$CONFIG_FILE.bak
1115

1216
if [[ ! -e "${HOME?}/$BACKUP_FILE" ]]; then
13-
echo -e "\033[0;33mBackup file ${HOME?}/$BACKUP_FILE not found.\033[0m" >&2
17+
printf '\e[0;33m%s\e[0m\n' "Backup file ~/$BACKUP_FILE not found."
1418

1519
test -w "${HOME?}/$CONFIG_FILE" \
1620
&& mv "${HOME?}/$CONFIG_FILE" "${HOME?}/$CONFIG_FILE.uninstall" \
17-
&& echo -e "\033[0;32mMoved your ${HOME?}/$CONFIG_FILE to ${HOME?}/$CONFIG_FILE.uninstall.\033[0m"
21+
&& printf '\e[0;32m%s\e[0m\n' "Moved your ~/$CONFIG_FILE to ~/$CONFIG_FILE.uninstall."
1822
else
1923
test -w "${HOME?}/$BACKUP_FILE" \
2024
&& cp -a "${HOME?}/$BACKUP_FILE" "${HOME?}/$CONFIG_FILE" \
2125
&& rm "${HOME?}/$BACKUP_FILE" \
22-
&& echo -e "\033[0;32mYour original $CONFIG_FILE has been restored.\033[0m"
26+
&& printf '\e[0;32m%s\e[0m\n' "Your original ~/$CONFIG_FILE has been restored."
2327
fi
2428

25-
echo ""
26-
echo -e "\033[0;32mUninstallation finished successfully! Sorry to see you go!\033[0m"
27-
echo ""
28-
echo "Final steps to complete the uninstallation:"
29-
echo " -> Remove the $BASH_IT folder"
30-
echo " -> Open a new shell/tab/terminal"
29+
printf '\n\e[0;32m%s\e[0m\n\n' "Uninstallation finished successfully! Sorry to see you go!"
30+
printf '%s\n' "Final steps to complete the uninstallation:"
31+
printf '\t%s\n' "-> Remove the ${BASH_IT//${HOME?}/\~} folder"
32+
printf '\t%s\n' "-> Open a new shell/tab/terminal"

0 commit comments

Comments
 (0)