scripts/db in rvm-0.1.32 vs scripts/db in rvm-0.1.33
- old
+ new
@@ -1,20 +1,27 @@
#!/usr/bin/env bash
+usage() {
+ printf "\nUsage:\n" >&2
+ printf "\n $rvm_scripts_path/db database_file {{key}} {{value}} # set" >&2
+ printf "\n $rvm_scripts_path/db database_file {{key}} # get" >&2
+ printf "\n $rvm_scripts_path/db database_file {{key}} unset # unset\n\n" >&2
+}
+
if [[ -f "$1" ]] ; then
database_file="$1" ; shift
if [[ ! -f "$database_file" ]] ; then
mkdir -p $(dirname $database_file)
touch $database_file
fi
else
- echo "Database file $1 does not exist." >&2
+ printf "\n\nDatabase file $1 does not exist.\n\n" >&2
exit 1
fi
key="$1" ; shift
if [[ -z "$key" ]] ; then
- echo "usage: $0 database key [value]" >&2
+ usage
exit 1
else
value="$*"
if [[ "unset" = "$value" ]] || [[ "delete" = "$value" ]] ; then
sed -i.tmp "s#^$key=.*\$##" $database_file