Skip to content
This repository has been archived by the owner on Dec 16, 2024. It is now read-only.

[24] - Update: showUsage function in run.sh #55

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,55 @@

source ./src/utils/logger.sh
source ./src/mojafos/commandline/commandline.sh
source ./src/mojafos/environment/environment.sh

mode=""
user=""
k8_version=""
kubernetes_distro="k3s"
force_flag=false

while getopts "m:u:v:k:fh" opt; do
case ${opt} in
m)
mode=$OPTARG
if [[ ! "$mode" =~ ^(install|delete)$ ]]; then
echo "Error: Invalid mode specified."
showUsage
exit 1
fi
;;
u)
user=$OPTARG
;;
v)
k8_version=$OPTARG
;;
k)
kubernetes_distro=$OPTARG
;;
f)
force_flag=true
;;
h)
showUsage
exit 0
;;
*)
showUsage
exit 1
;;
esac
done

if [ -z "$mode" ]; then
echo "Error: Mode (-m) is required."
showUsage
exit 1
fi

echo "Mode: $mode"
echo "User: $user"
echo "Kubernetes Version: $k8_version"
echo "Kubernetes Distro: $kubernetes_distro"
echo "Force Flag: $force_flag"
4 changes: 2 additions & 2 deletions src/mojafos/commandline/commandline.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Options:
function getoptions {
local mode_opt

while getopts "m:n:d:a:f:e:u:hH" OPTION ; do
while getopts "m:k:d:a:f:e:u:hH" OPTION ; do
case "${OPTION}" in
m) mode_opt="${OPTARG}"
;;
Expand Down Expand Up @@ -129,4 +129,4 @@ function main {
###########################################################################
# CALL TO MAIN
###########################################################################
main "$@"
main "$@"