mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-11 03:32:53 +01:00
Always print a line of '-'
Even when not printing to a tty This is behavior preferred by the team
This commit is contained in:
@@ -175,23 +175,24 @@ print_line() {
|
|||||||
local service_state="" ; service_state="$( parse_status "${1}" "${2}" )"
|
local service_state="" ; service_state="$( parse_status "${1}" "${2}" )"
|
||||||
# XXX: What will we do if tput isn't avalable?
|
# XXX: What will we do if tput isn't avalable?
|
||||||
local line=""
|
local line=""
|
||||||
|
local columns=35 # value used if not printing to a tty
|
||||||
|
local PADDING_CONSTANT=16 # two tabs wide
|
||||||
|
|
||||||
if (( __tty == 1 )); then
|
if (( __tty == 1 )); then
|
||||||
local NC; NC="$(tput sgr0)" # no color
|
local NC; NC="$(tput sgr0)" # no color
|
||||||
local red=""; red="$(tput setaf 1 bold)"
|
local red; red="$(tput setaf 1 bold)"
|
||||||
local green; green="$(tput setaf 2 bold)"
|
local green; green="$(tput setaf 2 bold)"
|
||||||
local yellow; yellow="$(tput setaf 3 bold)"
|
local yellow; yellow="$(tput setaf 3 bold)"
|
||||||
|
|
||||||
# construct a line of '------' so that the names and states are all aligned
|
columns=$(tput cols)
|
||||||
local PADDING_CONSTANT=16 # two tabs wide
|
|
||||||
PADDING_CONSTANT=$((PADDING_CONSTANT + PADDING_CONSTANT / 2))
|
|
||||||
local columns ; columns=$(tput cols)
|
|
||||||
linewidth=$(( columns - PADDING_CONSTANT - ${#service_name} - ${#service_state} ))
|
|
||||||
|
|
||||||
for i in $(seq 0 "${linewidth}"); do
|
|
||||||
line="${line}-"
|
|
||||||
done
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# construct a line of '------' so that the names and states are all aligned
|
||||||
|
linewidth=$(( columns - PADDING_CONSTANT - ${#service_name} - ${#service_state} ))
|
||||||
|
for i in $(seq 0 "${linewidth}"); do
|
||||||
|
line="${line}-"
|
||||||
|
done
|
||||||
|
|
||||||
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:-}"
|
||||||
|
|||||||
Reference in New Issue
Block a user