Browse Source

fixed param implimnetation to support toggle args

master
HMSheets 3 years ago
parent
commit
aa1574c141
1 changed files with 5 additions and 19 deletions
  1. +5
    -19
      refresh-NebulaCA

+ 5
- 19
refresh-NebulaCA View File

@@ -14,6 +14,9 @@ do
key="$1" key="$1"


case $key in case $key in
-h|--help)
help_msg
;;
-n|--caname) -n|--caname)
CANAME="$2" CANAME="$2"
shift # past argument shift # past argument
@@ -40,30 +43,12 @@ case $key in
shift # past value shift # past value
;; ;;
*) # unknown option *) # unknown option
POSITIONAL+=("$1") # save it in an array for later
shift # past argument
invalid_args_msg #catch all
;; ;;
esac esac
done done
set -- "${POSITIONAL[@]}" # restore positional parameters set -- "${POSITIONAL[@]}" # restore positional parameters


# Additional Parameter Evaluation
while [ -n "$1" ]; do # while loop starts

case "$1" in

-h) help_msg ;; # help

--h) help_msg ;; # help

*) invalid_args_msg ;; #catch all

esac

shift

done

invalid_args_msg () { invalid_args_msg () {
echo "Invalid Parameter(s) Entered: $1" echo "Invalid Parameter(s) Entered: $1"
exit exit
@@ -81,6 +66,7 @@ help_msg () {
echo " Name of the Org Issuing and authorizing the creation of the new Nebula CA" echo " Name of the Org Issuing and authorizing the creation of the new Nebula CA"
echo " -h|--help" echo " -h|--help"
echo " This help text, but you already knew that... right?!?!" echo " This help text, but you already knew that... right?!?!"
exit
} }


DATETIME=$(date '+%Y%m%d-%H%M%S') DATETIME=$(date '+%Y%m%d-%H%M%S')


Loading…
Cancel
Save