From a5816f08c8392b10ba24c4fc51e3dc886e148182 Mon Sep 17 00:00:00 2001 From: David Vazgenovich Shakaryan Date: Sun, 15 Jun 2014 02:14:26 -0700 Subject: Add program name to error messages. --- rpath.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'rpath.sh') diff --git a/rpath.sh b/rpath.sh index d71237c..7fa43d1 100755 --- a/rpath.sh +++ b/rpath.sh @@ -30,7 +30,7 @@ _export_path() { } _warn() { - echo "echo '${@//\'/\'\\\'\'}' 1>&2" + echo "echo 'rpath: ${@//\'/\'\\\'\'}' 1>&2" } _die() { @@ -42,14 +42,14 @@ _die() { _populate_dirs() { [[ -d "${RUBIES_PATH}" ]] \ - || _die "Directory ${RUBIES_PATH} does not exist." + || _die "directory ${RUBIES_PATH} does not exist." # Cannot handle paths containing a newline. Only an idiot would # encounter this in practice. readarray -t dirs < <(shopt -s nullglob; \ printf '%s\0' "${RUBIES_PATH}"/* | sort -zV | xargs -0n1) - [[ -n "${dirs}" ]] || _die "Directory ${RUBIES_PATH} is empty." + [[ -n "${dirs}" ]] || _die "directory ${RUBIES_PATH} is empty." } _match() { @@ -122,16 +122,16 @@ rpath_ls() { } rpath_get() { - current="$(_get)" || _die 'No rubies found in PATH.' + current="$(_get)" || _die 'no rubies found in PATH.' [[ $(wc -l <<< "${current}") -gt 1 ]] \ - && _warn 'Warning: multiple rubies found in PATH.' + && _warn 'warning: multiple rubies found in PATH.' _echo "${current}" } rpath_set() { - [[ -n "${1}" ]] || _die 'rpath set requires an argument.' + [[ -n "${1}" ]] || _die 'set command requires an argument.' _populate_dirs @@ -146,11 +146,11 @@ rpath_set() { fi done - _die 'No matching ruby found.' + _die 'no matching ruby found.' } rpath_clear() { - _clear || _die 'No rubies found in PATH.' + _clear || _die 'no rubies found in PATH.' _export_path } -- cgit v1.2.3-70-g09d2