Skip to content

Commit

Permalink
tools/uninstall: check env OSH for uninstallation target
Browse files Browse the repository at this point in the history
  • Loading branch information
akinomyoga committed Nov 17, 2024
1 parent 5ed4f55 commit abe4a3a
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions tools/uninstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,15 @@ _omb_uninstall_find_bashrc_original() {
fi
}

_omb_uninstall_confirmation "Are you sure you want to remove Oh My Bash? [y/N]"
_omb_uninstall_base_directory=${OSH:-$HOME/.oh-my-bash}
if [ ! -d "$_omb_uninstall_base_directory" ]; then
printf '%s\n' "Uninstall target '$_omb_uninstall_base_directory' not found."
unset -v _omb_uninstall_base_directory
# shellcheck disable=SC2317
return 0 2>/dev/null || exit 0
fi

_omb_uninstall_confirmation "Are you sure you want to remove Oh My Bash ($_omb_uninstall_base_directory)? [y/N]"
if [ "$_omb_uninstall_confirmation" != y ] && [ "$_omb_uninstall_confirmation" != Y ]; then
printf '%s\n' "Uninstall cancelled"
unset -v _omb_uninstall_confirmation
Expand All @@ -53,10 +61,9 @@ if [ "$_omb_uninstall_confirmation" != y ] && [ "$_omb_uninstall_confirmation" !
fi
unset -v _omb_uninstall_confirmation

if [ -d ~/.oh-my-bash ]; then
printf '%s\n' "Removing ~/.oh-my-bash"
command rm -rf ~/.oh-my-bash
fi
printf 'Removing %s\n' "$_omb_uninstall_base_directory"
command rm -rf "$_omb_uninstall_base_directory"
unset -v _omb_uninstall_base_directory

_omb_uninstall_bashrc_original=
_omb_uninstall_find_bashrc_original
Expand Down

0 comments on commit abe4a3a

Please sign in to comment.