|
@ -5303,15 +5303,26 @@ Usage: status [options] [SERVICE...] |
|
|
|
|
|
|
|
|
Options: |
|
|
Options: |
|
|
-h, --help Print this message and quit |
|
|
-h, --help Print this message and quit |
|
|
-a, --all Display status of all services |
|
|
|
|
|
(removes all filter, and will add a |
|
|
|
|
|
'root' first column by default) |
|
|
|
|
|
-c, --column Column to display, can provide several |
|
|
|
|
|
separated by commas, or option can be repeated. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-a, --all Display status of all services (removes all |
|
|
|
|
|
filter, and will add a 'root' first column by |
|
|
|
|
|
default) |
|
|
|
|
|
|
|
|
|
|
|
-c, --column Columns to display, can provide several separated |
|
|
|
|
|
by commas, or option can be repeated. You can add |
|
|
|
|
|
a sign prefix to the name of the column to force |
|
|
|
|
|
the alignment of the column (+: right, -: left), |
|
|
(default: ${state_columns_default_msg}) |
|
|
(default: ${state_columns_default_msg}) |
|
|
|
|
|
|
|
|
-f, --filter Filter services by a key=value pair, |
|
|
-f, --filter Filter services by a key=value pair, |
|
|
separated by commas or can be repeated. |
|
|
separated by commas or can be repeated. |
|
|
(default: --filter root=yes) |
|
|
(default: --filter root=yes) |
|
|
|
|
|
|
|
|
|
|
|
-r, --raw Raw data output (no colors nor alignment) |
|
|
|
|
|
|
|
|
|
|
|
-0 Separate field with NUL char. Implies raw data |
|
|
|
|
|
output. |
|
|
|
|
|
|
|
|
" |
|
|
" |
|
|
while read-0 arg; do |
|
|
while read-0 arg; do |
|
|
case "$arg" in |
|
|
case "$arg" in |
|
@ -5319,6 +5330,19 @@ Options: |
|
|
echo "$help" |
|
|
echo "$help" |
|
|
exit 0 |
|
|
exit 0 |
|
|
;; |
|
|
;; |
|
|
|
|
|
--raw|-r|-0) |
|
|
|
|
|
state_raw_output="$arg"; |
|
|
|
|
|
## check if any state_columns have alignements specs |
|
|
|
|
|
for col in "${state_columns[@]}"; do |
|
|
|
|
|
if [[ "$col" == [-+]* ]]; then |
|
|
|
|
|
err "Cannot use $arg and provide columns with alignment specs." |
|
|
|
|
|
exit 1 |
|
|
|
|
|
fi |
|
|
|
|
|
done |
|
|
|
|
|
if [[ "$arg" == "-0" ]]; then |
|
|
|
|
|
state_raw_output_nul=1 |
|
|
|
|
|
fi |
|
|
|
|
|
;; |
|
|
--all|-a) |
|
|
--all|-a) |
|
|
if [ "${#state_services[@]}" -gt 0 ]; then |
|
|
if [ "${#state_services[@]}" -gt 0 ]; then |
|
|
err "Cannot use --all and provide services at the same time." |
|
|
err "Cannot use --all and provide services at the same time." |
|
@ -5333,10 +5357,19 @@ Options: |
|
|
--column|-c) |
|
|
--column|-c) |
|
|
read-0 value |
|
|
read-0 value |
|
|
if [[ "$value" == *,* ]]; then |
|
|
if [[ "$value" == *,* ]]; then |
|
|
state_columns+=(${value//,/ }) |
|
|
|
|
|
|
|
|
state_columns_candidate=(${value//,/ }) |
|
|
else |
|
|
else |
|
|
state_columns+=("$value") |
|
|
|
|
|
|
|
|
state_columns_candidate=("$value") |
|
|
fi |
|
|
fi |
|
|
|
|
|
if [[ -n "$state_raw_output" ]]; then |
|
|
|
|
|
for col in "${state_columns_candidate[@]}"; do |
|
|
|
|
|
if [[ "$col" == [-+]* ]]; then |
|
|
|
|
|
err "Cannot use ${state_raw_output} and provide columns with alignment specs." |
|
|
|
|
|
exit 1 |
|
|
|
|
|
fi |
|
|
|
|
|
done |
|
|
|
|
|
fi |
|
|
|
|
|
state_columns+=("${state_columns_candidate[@]}") |
|
|
;; |
|
|
;; |
|
|
--filter|-f) |
|
|
--filter|-f) |
|
|
if [ "${#state_services[@]}" -gt 0 ]; then |
|
|
if [ "${#state_services[@]}" -gt 0 ]; then |
|
@ -5704,6 +5737,7 @@ if [ "$action" == "status" ]; then |
|
|
for col in "${state_columns_raw[@]}"; do |
|
|
for col in "${state_columns_raw[@]}"; do |
|
|
color= |
|
|
color= |
|
|
value="${!col}" |
|
|
value="${!col}" |
|
|
|
|
|
if [ -z "$state_raw_output" ]; then |
|
|
read -r -- value_trim <<<"${!col}" |
|
|
read -r -- value_trim <<<"${!col}" |
|
|
case "${col//_/-}" in |
|
|
case "${col//_/-}" in |
|
|
root) |
|
|
root) |
|
@ -5736,6 +5770,7 @@ if [ "$action" == "status" ]; then |
|
|
;; |
|
|
;; |
|
|
esac |
|
|
esac |
|
|
color="${color^^}" |
|
|
color="${color^^}" |
|
|
|
|
|
fi |
|
|
if [ -n "$color" ]; then |
|
|
if [ -n "$color" ]; then |
|
|
values+=("${!color}$value${NORMAL}") |
|
|
values+=("${!color}$value${NORMAL}") |
|
|
else |
|
|
else |
|
@ -5746,9 +5781,13 @@ if [ "$action" == "status" ]; then |
|
|
for value in "${values[@]}"; do |
|
|
for value in "${values[@]}"; do |
|
|
if [ -n "$first" ]; then |
|
|
if [ -n "$first" ]; then |
|
|
first= |
|
|
first= |
|
|
|
|
|
else |
|
|
|
|
|
if [ -n "$state_raw_output_nul" ]; then |
|
|
|
|
|
printf "\0" |
|
|
else |
|
|
else |
|
|
printf " " |
|
|
printf " " |
|
|
fi |
|
|
fi |
|
|
|
|
|
fi |
|
|
printf "%s" "$value" |
|
|
printf "%s" "$value" |
|
|
done |
|
|
done |
|
|
printf "\n" |
|
|
printf "\n" |
|
@ -5812,7 +5851,13 @@ if [ "$action" == "status" ]; then |
|
|
for col in "${state_columns_raw[@]}"; do |
|
|
for col in "${state_columns_raw[@]}"; do |
|
|
p0 "${values[$col]}" |
|
|
p0 "${values[$col]}" |
|
|
done |
|
|
done |
|
|
done | col-0:normalize:size "${state_columns_align}" |
|
|
|
|
|
|
|
|
done | { |
|
|
|
|
|
if [ -z "$state_raw_output" ]; then |
|
|
|
|
|
col-0:normalize:size "${state_columns_align}" |
|
|
|
|
|
else |
|
|
|
|
|
cat |
|
|
|
|
|
fi |
|
|
|
|
|
} |
|
|
echo 0 |
|
|
echo 0 |
|
|
) |
|
|
) |
|
|
if [ "$E" != 0 ]; then |
|
|
if [ "$E" != 0 ]; then |
|
|