mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-07 01:32:47 +01:00
Refactored to reduce length and number of lines
This commit is contained in:
@@ -184,8 +184,6 @@ print_line() {
|
|||||||
fi
|
fi
|
||||||
state_color="${NC}"
|
state_color="${NC}"
|
||||||
|
|
||||||
local PADDING_CONSTANT=16 # two tabs wide
|
|
||||||
|
|
||||||
if [[ $service_state = "$ERROR_STRING" ]] \
|
if [[ $service_state = "$ERROR_STRING" ]] \
|
||||||
|| [[ $service_state = "$MISSING_STRING" ]]; then
|
|| [[ $service_state = "$MISSING_STRING" ]]; then
|
||||||
state_color="${red:-}"
|
state_color="${red:-}"
|
||||||
@@ -205,6 +203,8 @@ print_line() {
|
|||||||
line=""
|
line=""
|
||||||
if [ "${__tty}" -eq 1 ]; then
|
if [ "${__tty}" -eq 1 ]; then
|
||||||
# construct a line of '------' so that the names and states are all aligned
|
# construct a line of '------' so that the names and states are all aligned
|
||||||
|
local PADDING_CONSTANT=16 # two tabs wide
|
||||||
|
PADDING_CONSTANT=$((PADDING_CONSTANT + PADDING_CONSTANT / 2))
|
||||||
local columns ; columns=$(tput cols)
|
local columns ; columns=$(tput cols)
|
||||||
linewidth=$(( columns - PADDING_CONSTANT - ${#service_name} - ${#service_state} ))
|
linewidth=$(( columns - PADDING_CONSTANT - ${#service_name} - ${#service_state} ))
|
||||||
for i in $(seq 0 "${linewidth}"); do
|
for i in $(seq 0 "${linewidth}"); do
|
||||||
@@ -285,28 +285,10 @@ main() {
|
|||||||
|
|
||||||
# {% endraw %}
|
# {% endraw %}
|
||||||
|
|
||||||
while getopts ':hq' OPTION; do
|
|
||||||
case "$OPTION" in
|
|
||||||
h)
|
|
||||||
display_help
|
|
||||||
exit 0
|
|
||||||
;;
|
|
||||||
q)
|
|
||||||
QUIET=true
|
|
||||||
;;
|
|
||||||
\?)
|
|
||||||
display_help
|
|
||||||
exit 0
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
is_tty() {
|
is_tty() {
|
||||||
__tty=0
|
__tty=0
|
||||||
# don't print colors if NO_COLOR is set to anything
|
# don't print colors if NO_COLOR is set to anything
|
||||||
if [ "${#NO_COLOR}" -eq 0 ]
|
if [ "${#NO_COLOR}" -ne 0 ]
|
||||||
then
|
then
|
||||||
__tty=0
|
__tty=0
|
||||||
return "${__tty}"
|
return "${__tty}"
|
||||||
|
|||||||
Reference in New Issue
Block a user