From 4129397cf3421b3e8afec0402241f696fd613576 Mon Sep 17 00:00:00 2001 From: David Vazgenovich Shakaryan Date: Sun, 15 Jun 2014 18:34:30 -0700 Subject: Remove support for number-based matching. --- rpath.sh | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) (limited to 'rpath.sh') diff --git a/rpath.sh b/rpath.sh index d37b568..7ba2d90 100755 --- a/rpath.sh +++ b/rpath.sh @@ -13,10 +13,8 @@ # # rpath() { source <(/path/to/rpath.sh "${@}"); } # -# Two methods of version matching are supported. If the specified -# argument consists of only numbers, it is matched against the list -# number shown in `rpath ls`. Otherwise, a substring match is performed -# against the directory name. +# Placing the above function inside ~/.bashrc (or equivalent) will load +# it upon starting your shell. : ${RUBIES_PATH:="${HOME}/.rubies"} @@ -94,24 +92,12 @@ _add() { PATH="${1}/bin:${PATH}" } -_match() { - if [[ "${1}" =~ ^[0-9]+$ ]]; then - [[ "${2}" == "${1}" ]] && return - else - [[ "${3}" == *"${1}"* ]] && return - fi - - return 1 -} - rpath_ls() { _populate_dirs _populate_selected - counter=0 - for dir in "${dirs[@]}"; do - str=" [$((++counter))] ${dir##*/}" + str=" ${dir##*/}" [[ "${dir##*/}" == "${selected}" ]] && str="${str/ /*}" @@ -132,10 +118,8 @@ rpath_set() { _populate_dirs - counter=0 - for dir in "${dirs[@]}"; do - if _match "${1}" "$((++counter))" "${dir##*/}"; then + if [[ "${dir##*/}" == *"${1}"* ]]; then _clear _add "${dir}" _export -- cgit v1.2.3-70-g09d2