diff --git a/refresh-NebulaCA b/refresh-NebulaCA index b306d20..5f3ce79 100644 --- a/refresh-NebulaCA +++ b/refresh-NebulaCA @@ -7,12 +7,42 @@ # Created By: HMSheets ###################################################### -invalid_args_msg () { - echo "Invalid Parameter(s) Entered: $1" +# Try Catch Functions +function try() +{ + [[ $- = *e* ]]; SAVED_OPT_E=$? + set +e +} + +function throw() +{ + exit $1 +} + +function catch() +{ + export ex_code=$? + (( $SAVED_OPT_E )) && set +e + return $ex_code +} + +function throwErrors() +{ + set -e +} + +function ignoreErrors() +{ + set +e +} + +# Parameter Eval Fuctions +function invalid_args_msg () { + echo "Invalid Parameter(s) Entered" exit } -help_msg () { +function help_msg () { echo "Usage of refresh-NebulaCA : refresh an existing nebula ca" echo " -n|--caname" echo " Name to use for the new CA. Used in the CA cert file and in the filename" @@ -27,6 +57,7 @@ help_msg () { exit } +# Parameter Evaluation while loop POSITIONAL=() while [[ $# -gt 0 ]] do