scripts/cleanup in rvm-1.0.11 vs scripts/cleanup in rvm-1.0.13
- old
+ new
@@ -1,10 +1,11 @@
#!/usr/bin/env bash
rvm_base_except="selector"
source "$rvm_path/scripts/base"
-usage() {
+usage()
+{
printf "
Usage:
rvm cleanup {all,archives,repos,sources,logs}
@@ -14,18 +15,20 @@
Cleans up the directory tree for the specified item.
"
return 0
}
-cleanup() {
+cleanup()
+{
local cleanup_type current_path
for cleanup_type in $1; do
- eval "current_path=\"\$rvm_${cleanup_type}_path\""
+ current_path="${rvm_path}/${cleanup_type}"
- if [[ -n "$current_path" && -d "$current_path" && "$current_path" != "/" ]]; then
+ if [[ -n "$current_path" && -d "$current_path" \
+ && "$current_path" != "/" ]]; then
"$rvm_path/scripts/log" "info" \
"Cleaning up rvm directory '$current_path'"
rm -rf "$current_path"/* >/dev/null 2>&1
@@ -41,12 +44,12 @@
if [[ -z "${1:-""}" ]] ; then
usage
fi
case "$1" in
- all) cleanup "archives repo src log" ;;
+ all) cleanup "archives repos src log" ;;
archives) cleanup "archives" ;;
- repos) cleanup "repo" ;;
+ repos) cleanup "repos" ;;
sources) cleanup "src" ;;
logs) cleanup "log" ;;
help) usage ;;
*) usage ; exit 1;;
esac