diff options
-rw-r--r-- | README.md | 4 | ||||
-rwxr-xr-x | kerl | 20 |
2 files changed, 20 insertions, 4 deletions
@@ -681,6 +681,10 @@ will eventually deal with this issue. Changelog --------- +13 November 2017 - 1.8.1 + + - Fix removing an installation by its name. (#244) + 8 November 2017 - 1.8.0 - Include support for installing and managing docsh (#213) @@ -24,7 +24,7 @@ unset ERL_TOP -KERL_VERSION="1.8.0" +KERL_VERSION="1.8.1" #Grep fix for mac pcre errors GREP_OPTIONS='' @@ -301,7 +301,7 @@ is_valid_installation() name=$(echo "$l" | cut -d " " -f 1) path=$(echo "$l" | cut -d " " -f 2) if [ "$name" = "$1" -o "$path" = "$1" ]; then - if [ -f "$1"/activate ]; then + if [ -f "$path"/activate ]; then return 0 fi fi @@ -1587,6 +1587,14 @@ get_name_from_install_path() return 0 } +get_install_path_from_name() +{ + if [ -f "$KERL_BASE_DIR"/otp_installations ]; then + grep -m1 -E "$1$" "$KERL_BASE_DIR"/otp_installations | cut -d' ' -f2 + fi + return 0 +} + do_active() { ACTIVE_PATH="$(get_active_path)" @@ -2002,10 +2010,14 @@ case "$1" in ;; installation) assert_valid_installation "$3" - maybe_remove "$3" + if [ -d "$3" ]; then + maybe_remove "$3" + else + maybe_remove "$(get_install_path_from_name "$3")" + fi escaped="$(echo "$3" | sed $SED_OPT -e 's#/$##' -e 's#\/#\\\/#g')" list_remove "$2"s "$escaped" - echo "The installation in $3 has been deleted" + echo "The installation \"$3\" has been deleted" ;; *) echo "Cannot delete $2" |