From 11cf17750885324a58a68d237b0ac29bc3a6269b Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Sun, 20 Oct 2013 18:09:50 +0200 Subject: o Making all app-conf options except import use <-l location>. o Setting $HOME to the temporary area when testing. o Adding test docs for app-conf. --- libexec/app-cat-conf | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'libexec/app-cat-conf') diff --git a/libexec/app-cat-conf b/libexec/app-cat-conf index ce0a3ef..49d3284 100755 --- a/libexec/app-cat-conf +++ b/libexec/app-cat-conf @@ -16,7 +16,9 @@ declare -a arg_files name="" use_default_files=yes -while getopts "f:Dn:" opt +location=app + +while getopts "f:Dn:l:" opt do case $opt in f) @@ -33,26 +35,33 @@ do n) name=$OPTARG ;; + l) + location=$OPTARG + ;; \?) - usage "Invalid option: $OPTARG" + usage "Invalid option: $opt" ;; esac done +validate_location location + if [[ $use_default_files == yes ]] then - app_home=${APP_HOME-.} + _get_config_file_system config_s + _get_config_file_user config_u + _get_config_file_app config_a - files+=(${APPSH_DEFAULT_CONFIG-$APPSH_HOME/lib/default-config}) + files+=($config_s) - if [ -r "$HOME/.appconfig" ] + if [ "$location" -ge 2 -a -r "$config_u" ] then - files+=("$HOME/.appconfig") + files+=("$config_u") fi - if [ -r "$app_home/.app/config" ] + if [ "$location" -ge 3 -a -r "$config_a" ] then - files+=("$app_home/.app/config") + files+=("$config_a") fi fi -- cgit v1.2.3