Skip to content

Commit

Permalink
refactor: improve query output formatting
Browse files Browse the repository at this point in the history
The code changes refactor the query output formatting in the command_dev_query_raw.sh file. The changes include:
- Adding italics to certain command outputs for better readability
- Removing unnecessary echo statements
- Updating comments and indentation for clarity
  • Loading branch information
dgibbs64 committed Oct 1, 2023
1 parent 07a1eef commit 19cb223
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions lgsm/modules/command_dev_query_raw.sh
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,13 @@ fn_messages_separator

} \
| column -s $'\t' -t

echo -e ""
echo -e "${bold}${lightyellow}SS Output${default}"
fn_messages_separator
fn_info_message_ports
eval "${portcommand}"

echo -e ""
echo -e "${bold}${lightyellow}Query Port (${queryport}) - Gamedig Output${default}"
fn_messages_separator
Expand All @@ -196,28 +198,30 @@ if [ ! "$(command -v gamedig 2> /dev/null)" ]; then
fi
for queryip in "${queryips[@]}"; do
query_gamedig.sh
echo -e "${gamedigcmd}"
echo -e "${italic}${gamedigcmd}${default}"
echo""
echo "${gamedigraw}" | jq
done

echo -e ""
echo -e "${bold}${lightyellow}Query Port (${queryport}) - gsquery Output${default}"
fn_messages_separator
echo -e ""
for queryip in "${queryips[@]}"; do
echo -e "./query_gsquery.py -a \"${queryip}\" -p \"${queryport}\" -e \"${querytype}\""
echo -e "${italic}./query_gsquery.py -a \"${queryip}\" -p \"${queryport}\" -e \"${querytype}\"${default}"
echo -e ""
if [ ! -f "${modulesdir}/query_gsquery.py" ]; then
fn_fetch_file_github "lgsm/modules" "query_gsquery.py" "${modulesdir}" "chmodx" "norun" "noforce" "nohash"
fi
"${modulesdir}"/query_gsquery.py -a "${queryip}" -p "${queryport}" -e "${querytype}"
done

echo -e ""
echo -e "${bold}${lightyellow}Query Port (${queryport}) - TCP Output${default}"
fn_messages_separator
echo -e ""
for queryip in "${queryips[@]}"; do
echo -e "bash -c 'exec 3<> /dev/tcp/'${queryip}'/'${queryport}''"
echo -e "${italic}bash -c 'exec 3<> /dev/tcp/'${queryip}'/'${queryport}''${default}"
echo -e ""
timeout 3 bash -c 'exec 3<> /dev/tcp/'${queryip}'/'${queryport}''
querystatus="$?"
Expand All @@ -233,7 +237,7 @@ echo -e "${bold}${lightyellow}Game Port (${port}) - TCP Output${default}"
fn_messages_separator
echo -e ""
for queryip in "${queryips[@]}"; do
echo -e "bash -c 'exec 3<> /dev/tcp/'${queryip}'/'${port}''"
echo -e "${italic}bash -c 'exec 3<> /dev/tcp/'${queryip}'/'${port}''${default}"
echo -e ""
timeout 3 bash -c 'exec 3<> /dev/tcp/'${queryip}'/'${port}''
querystatus="$?"
Expand Down

0 comments on commit 19cb223

Please sign in to comment.