Fix command line opts

This commit is contained in:
benn 2025-06-08 15:47:50 +02:00
parent ccc76cec6c
commit fafce962b2

View file

@ -92,12 +92,11 @@ main()
OPT_ALL="$(getopt -o dhm:p:r: -l debug,help,main:,project:,repo: --name "$0" -- "$@")" OPT_ALL="$(getopt -o dhm:p:r: -l debug,help,main:,project:,repo: --name "$0" -- "$@")"
eval set -- "$OPT_ALL" eval set -- "$OPT_ALL"
while true ; do while true ; do
case $1 in case $1 in
-d | --debug) -d | --debug)
OPT_DEBUG=True OPT_DEBUG=True
shift shift 1
;; ;;
-h | --help) # Call help -h | --help) # Call help
help help
@ -105,26 +104,28 @@ main()
;; ;;
-m | --main) -m | --main)
OPT_MAIN=$2 OPT_MAIN=$2
shift 2
;; ;;
-p | --project) -p | --project)
OPT_PROJECT=$2 OPT_PROJECT=$2
#shift 2 shift 2
;; ;;
-r | --repo ) -r | --repo )
OPT_REPO=$2 OPT_REPO=$2
#shift 2 shift 2
;; ;;
--) --)
shift shift
break break
;; ;;
*) *)
echo "Invalid argument" >&2 echo "Invalid argument"
exit 1 exit 1
;; ;;
esac esac
done done
if [[ $OPT_DEBUG == "True" ]]; then if [[ $OPT_DEBUG == "True" ]]; then
trap 'echo "At line $LINENO: $BASH_COMMAND"' DEBUG trap 'echo "At line $LINENO: $BASH_COMMAND"' DEBUG
fi fi