aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2013-02-01 09:28:18 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2013-02-01 09:28:18 +0100
commit97036aeae73cc2a63219c7b792ab5f18c7d98cd1 (patch)
treeb71a4e0ebde196ad7b4858f4dbaf499b7b3b7201 /lib
parent537935edab2e847196a46be68956c8ed2300a22a (diff)
downloadapp.sh-97036aeae73cc2a63219c7b792ab5f18c7d98cd1.tar.gz
app.sh-97036aeae73cc2a63219c7b792ab5f18c7d98cd1.tar.bz2
app.sh-97036aeae73cc2a63219c7b792ab5f18c7d98cd1.tar.xz
app.sh-97036aeae73cc2a63219c7b792ab5f18c7d98cd1.zip
libexec/app-resolver-maven: Better argument checking.
lib/common: Starting a way to have a common usage/help semantics.
Diffstat (limited to 'lib')
-rwxr-xr-xlib/common15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/common b/lib/common
index e90f77b..63f712a 100755
--- a/lib/common
+++ b/lib/common
@@ -40,6 +40,21 @@ assert_is_app() {
fi
}
+usage() {
+ message=${1-}
+
+ if [[ $message != "" ]]
+ then
+ echo $message
+ fi
+
+ if [ "`declare -f usage_inner >/dev/null; echo $?`" = 0 ]
+ then
+ usage_inner >&2
+ fi
+ exit 1
+}
+
debug() {
[[ $echo_debug == no ]] || echo "D: $usage_app: $@" 2>&1
}