aboutsummaryrefslogtreecommitdiff
path: root/libexec
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2013-10-20 18:09:50 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2013-10-20 20:23:30 +0200
commit11cf17750885324a58a68d237b0ac29bc3a6269b (patch)
tree474da312f12a82629b495b5901c10ea49b08e98c /libexec
parentd2e3a3795f345fd78ead2cf06b1134b46f9d4bc4 (diff)
downloadapp.sh-11cf17750885324a58a68d237b0ac29bc3a6269b.tar.gz
app.sh-11cf17750885324a58a68d237b0ac29bc3a6269b.tar.bz2
app.sh-11cf17750885324a58a68d237b0ac29bc3a6269b.tar.xz
app.sh-11cf17750885324a58a68d237b0ac29bc3a6269b.zip
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.
Diffstat (limited to 'libexec')
-rwxr-xr-xlibexec/app-cat-conf25
-rwxr-xr-xlibexec/app-resolver-file4
-rwxr-xr-xlibexec/app-resolver-maven5
3 files changed, 21 insertions, 13 deletions
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
diff --git a/libexec/app-resolver-file b/libexec/app-resolver-file
index 500b3a0..5aedf88 100755
--- a/libexec/app-resolver-file
+++ b/libexec/app-resolver-file
@@ -24,7 +24,7 @@ init() {
OPTIND=1
;;
*)
- usage "Invalid option: $OPTARG"
+ usage "Invalid option: $OPTARG"
;;
esac
done
@@ -59,7 +59,7 @@ download_version() {
target="$OPTARG"
;;
*)
- usage "Invalid option: $OPTARG"
+ usage "Invalid option: $OPTARG"
;;
esac
done
diff --git a/libexec/app-resolver-maven b/libexec/app-resolver-maven
index 118223a..5af7596 100755
--- a/libexec/app-resolver-maven
+++ b/libexec/app-resolver-maven
@@ -18,7 +18,6 @@ slash() {
echo $1 | sed "s,\.,/,g"
}
-# TODO: support file:// repositories
# TODO: look in the local repository first
get() {
local url=$1; shift
@@ -149,7 +148,7 @@ download_version() {
target="$OPTARG"
;;
*)
- usage "Invalid option: $OPTARG"
+ usage "Invalid option: $OPTARG"
;;
esac
done
@@ -189,7 +188,7 @@ init() {
OPTIND=1
;;
*)
- usage "Invalid option: $OPTARG"
+ usage "Invalid option: $OPTARG"
;;
esac
done