diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2012-10-12 23:23:10 +0200 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2012-10-12 23:23:10 +0200 |
commit | cdfcae52a49118d43e2064dd228b789b8452664f (patch) | |
tree | 62ee1d5f74adf0d085e9421b7a17ab3162dfde96 /.app/lib/app-conf | |
parent | 33ac32f2351b688300e656dfca3f7f6d69e56949 (diff) | |
download | app.sh-cdfcae52a49118d43e2064dd228b789b8452664f.tar.gz app.sh-cdfcae52a49118d43e2064dd228b789b8452664f.tar.bz2 app.sh-cdfcae52a49118d43e2064dd228b789b8452664f.tar.xz app.sh-cdfcae52a49118d43e2064dd228b789b8452664f.zip |
Major refactoring. Splitting out the method groups into separate files.
Diffstat (limited to '.app/lib/app-conf')
-rw-r--r-- | .app/lib/app-conf | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/.app/lib/app-conf b/.app/lib/app-conf index 3fcfe88..fa705e4 100644 --- a/.app/lib/app-conf +++ b/.app/lib/app-conf @@ -95,16 +95,18 @@ conf_delete() { mv $file.tmp $file } -conf_usage() { +method_conf_usage() { if [ -n "$1" ] then echo "Error:" $@ >&2 fi - echo "usage:" >&2 + echo "usage: $0 conf <method>" >&2 echo "" - echo " $0 conf -n name -i instance" >&2 - echo " $0 conf -n name -i instance -s [group.key] [value]" >&2 + echo "Available methods:" >&2 + echo " get - list all configuration parameters" >&2 + echo " set [group.key] [value] - set a configuration parameter" >&2 + echo " delete [group.key] - deletes a configuration parameter" >&2 exit 1 } @@ -117,24 +119,24 @@ method_conf() { do case $opt in n) - name=$OPTARG + name="$OPTARG" ;; i) - instance=$OPTARG + instance="$OPTARG" ;; d) mode="delete" - key=$OPTARG + key="$OPTARG" ;; s) mode="set" - key=$OPTARG + key="$OPTARG" # Remove all options so far shift $((OPTIND-1)) value="$1" ;; \?) - conf_usage "Invalid option: -$OPTARG" + method_conf_usage "Invalid option: -$OPTARG" ;; esac done |