Fix command line opts
This commit is contained in:
parent
ccc76cec6c
commit
fafce962b2
1 changed files with 7 additions and 6 deletions
13
nb_create.sh
13
nb_create.sh
|
|
@ -88,16 +88,15 @@ if_no_file_then_exit()
|
||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
OPT_DEBUG=False # By default, debugging is off
|
OPT_DEBUG=False # By default, debugging is off
|
||||||
|
|
||||||
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
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue