aboutsummaryrefslogtreecommitdiff
path: root/rpath.sh
diff options
context:
space:
mode:
authorDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2014-06-15 02:14:26 -0700
committerDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2014-06-15 02:14:26 -0700
commita5816f08c8392b10ba24c4fc51e3dc886e148182 (patch)
tree880d786d0eefc20cd40f92ffa045aef895e2b93b /rpath.sh
parent60a0e7180937ef85c6a04a6c82e57c2ffab52d7a (diff)
downloadrbpm-a5816f08c8392b10ba24c4fc51e3dc886e148182.tar.gz
rbpm-a5816f08c8392b10ba24c4fc51e3dc886e148182.tar.xz
Add program name to error messages.
Diffstat (limited to 'rpath.sh')
-rwxr-xr-xrpath.sh16
1 files changed, 8 insertions, 8 deletions
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
}