Skip to content

Commit

Permalink
Fix menu selection when installed version not present, and so can all…
Browse files Browse the repository at this point in the history
…ow rm of active
  • Loading branch information
shadowspawn committed Dec 4, 2018
1 parent 3366d06 commit 1e98421
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions bin/n
Original file line number Diff line number Diff line change
Expand Up @@ -227,15 +227,15 @@ show_cursor() {
#

next_version_installed() {
list_versions_installed | grep $selected -A 1 | tail -n 1
list_versions_installed | grep "$selected" -A 1 | tail -n 1
}

#
# Output version before selected.
#

prev_version_installed() {
list_versions_installed | grep $selected -B 1 | head -n 1
list_versions_installed | grep "$selected" -B 1 | head -n 1
}

#
Expand Down Expand Up @@ -606,10 +606,8 @@ set_quiet() {

remove_versions() {
test -z $1 && abort "version(s) required"
check_current_version
while test $# -ne 0; do
local version=${1#v}
[ "${BINS[$DEFAULT]}/$version" == "$active" ] && abort "cannot remove currently active version ($active)"
rm -rf ${VERSIONS_DIR[$DEFAULT]}/$version
shift
done
Expand Down

0 comments on commit 1e98421

Please sign in to comment.