Fix command line opts

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

View file

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