Skip to content

Commit

Permalink
print
Browse files Browse the repository at this point in the history
  • Loading branch information
dgibbs64 committed Oct 6, 2024
1 parent 981938d commit 8feb4b2
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions lgsm/modules/core_getopt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -158,27 +158,27 @@ currentopt+=("${cmd_sponsor[@]}")
optcommands=()
index="0"
for ((index = "0"; index < ${#currentopt[@]}; index += 3)); do
cmdamount=$(echo -e "${currentopt[index]}" | awk -F ';' '{ print NF }')
cmdamount=$(fn_print_nl "${currentopt[index]}" | awk -F ';' '{ print NF }')
for ((cmdindex = 1; cmdindex <= cmdamount; cmdindex++)); do
optcommands+=("$(echo -e "${currentopt[index]}" | awk -F ';' -v x=${cmdindex} '{ print $x }')")
optcommands+=("$(fn_print_nl "${currentopt[index]}" | awk -F ';' -v x=${cmdindex} '{ print $x }')")
done
done

# Shows LinuxGSM usage.
fn_opt_usage() {
echo -e "Usage: $0 [option]"
echo -e ""
echo -e "LinuxGSM - ${gamename} - Version ${version}"
echo -e "https://linuxgsm.com/${gameservername}"
echo -e ""
echo -e "${bold}${lightyellow}Commands${default}"
fn_print_nl "Usage: $0 [option]"
fn_print_nl ""
fn_print_nl "LinuxGSM - ${gamename} - Version ${version}"
fn_print_nl "https://linuxgsm.com/${gameservername}"
fn_print_nl ""
fn_print_nl "${bold}${lightyellow}Commands${default}"
# Display available commands.
index="0"
{
for ((index = "0"; index < ${#currentopt[@]}; index += 3)); do
# Hide developer commands.
if [ "${currentopt[index + 2]}" != "DEVCOMMAND" ]; then
echo -e "${cyan}$(echo -e "${currentopt[index]}" | awk -F ';' '{ print $2 }')\t${default}$(echo -e "${currentopt[index]}" | awk -F ';' '{ print $1 }')\t| ${currentopt[index + 2]}"
fn_print_nl "${cyan}$(fn_print_nl "${currentopt[index]}" | awk -F ';' '{ print $2 }')\t${default}$(fn_print_nl "${currentopt[index]}" | awk -F ';' '{ print $1 }')\t| ${currentopt[index + 2]}"
fi
done
} | column -s $'\t' -t
Expand All @@ -196,9 +196,9 @@ for i in "${optcommands[@]}"; do
# Seek and run command.
index="0"
for ((index = "0"; index < ${#currentopt[@]}; index += 3)); do
currcmdamount=$(echo -e "${currentopt[index]}" | awk -F ';' '{ print NF }')
currcmdamount=$(fn_print_nl "${currentopt[index]}" | awk -F ';' '{ print NF }')
for ((currcmdindex = 1; currcmdindex <= currcmdamount; currcmdindex++)); do
if [ "$(echo -e "${currentopt[index]}" | awk -F ';' -v x=${currcmdindex} '{ print $x }')" == "${getopt}" ]; then
if [ "$(fn_print_nl "${currentopt[index]}" | awk -F ';' -v x=${currcmdindex} '{ print $x }')" == "${getopt}" ]; then
# Run command.
eval "${currentopt[index + 1]}"
# Exit should occur in modules. Should this not happen print an error
Expand Down

0 comments on commit 8feb4b2

Please sign in to comment.