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
|
#!/bin/bash
|
||||||
# set -x
|
# set -x
|
||||||
|
|
||||||
|
source ./general_utils
|
||||||
source ./log_helpers
|
source ./log_helpers
|
||||||
source ./git_helpers
|
source ./git_helpers
|
||||||
|
|
||||||
@ -162,18 +163,53 @@ update() {
|
|||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
if [ $# -ne 1 ] ; then
|
if [ -z $IFS ]; then
|
||||||
echo "Usage: $0 filename"
|
IFS=$'\n'
|
||||||
exit 1
|
fi
|
||||||
else
|
|
||||||
if [ -z $IFS ]; then
|
readonly PROGRAM=`basename $0`
|
||||||
IFS=$'\n'
|
readonly VERSION="0.8.0"
|
||||||
fi
|
|
||||||
|
config_filename=""
|
||||||
if read_config "$1" ; then
|
|
||||||
|
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
|
# set -x
|
||||||
if clone_customer_repository $customer_repository_path ; then
|
if clone_customer_repository $customer_repository_path ; then
|
||||||
update
|
update
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
error "config-file missing"
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user