added command line parsing
This commit is contained in:
parent
22fbaded16
commit
7d9fc7cb23
54
update_psa
54
update_psa
@ -1,6 +1,7 @@
|
||||
#!/bin/bash
|
||||
# set -x
|
||||
|
||||
source ./general_utils
|
||||
source ./log_helpers
|
||||
source ./git_helpers
|
||||
|
||||
@ -162,18 +163,53 @@ update() {
|
||||
|
||||
###############################################################################
|
||||
|
||||
if [ $# -ne 1 ] ; then
|
||||
echo "Usage: $0 filename"
|
||||
exit 1
|
||||
else
|
||||
if [ -z $IFS ]; then
|
||||
IFS=$'\n'
|
||||
fi
|
||||
|
||||
if read_config "$1" ; then
|
||||
if [ -z $IFS ]; then
|
||||
IFS=$'\n'
|
||||
fi
|
||||
|
||||
readonly PROGRAM=`basename $0`
|
||||
readonly VERSION="0.8.0"
|
||||
|
||||
config_filename=""
|
||||
|
||||
while test $# -gt 0; do
|
||||
case $1 in
|
||||
--file | --fil | --fi | --f | -file | -fil | -fi | -f )
|
||||
__conf_file=yes
|
||||
;;
|
||||
--help | -hel | --he | --h | '--?' | -help | -hel | -he | -h | '-?' )
|
||||
usage_and_exit 0
|
||||
;;
|
||||
--version | --versio | --versi | --vers | --ver | --ve | --v | \
|
||||
-version | -versio | -versi | -vers | -ver | -ve | -v )
|
||||
version
|
||||
;;
|
||||
--dbg | --db | --d | -dbg | -db | -d )
|
||||
set_dbg_level $DEBUG
|
||||
;;
|
||||
-*)
|
||||
error "Unrecognized option: $1"
|
||||
;;
|
||||
*)
|
||||
if [ "$__conf_file" = "yes" ]; then
|
||||
config_filename="$1"
|
||||
__conf_file=""
|
||||
else
|
||||
error "Unrecognized parameter string: $1"
|
||||
fi
|
||||
break
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
if ! [ -z "$config_filename" ]; then
|
||||
if read_config "$config_filename" ; then
|
||||
# set -x
|
||||
if clone_customer_repository $customer_repository_path ; then
|
||||
update
|
||||
fi
|
||||
fi
|
||||
else
|
||||
error "config-file missing"
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user