Unify status with list

This commit is contained in:
Salt 2020-09-28 15:23:09 -05:00
parent abdb942772
commit 2749f6816e

View File

@ -151,27 +151,34 @@ fslist() {
# Skip our logs directory
[ -d "$file" ] && continue
if [ -t 1 ]; then
local len=16
local status
local errrorline
if gettarget "$file"; then
printf "$(basename -- "$file"): \e[32m$_return\e[0m\n"
status="\e[32m●\e[0m"
errorline="$_return"
else
local targeterror="$?"
local errrorline
case $targeterror in
2)
errorline="\e[31mNo matches found"
status="\e[31m●\e[0m"
errorline="\e[31mNo matches found\e[0m"
;;
50)
errorline="\e[33mNot an fsdefaults service"
status="\e[33m●\e[0m"
errorline="\e[33mNot an fsdefaults service\e[0m"
;;
51)
errorline="\e[35mDisabled"
status="\e[35m○\e[0m"
errorline="\e[35mDisabled\e[0m"
;;
*)
errorline="\e[31mNot a valid file"
status="\e[31m●\e[0m"
errorline="\e[31mNot a valid file\e[0m"
;;
esac
printf "$(basename -- "$file"): $errorline\e[0m\n"
fi
printf "$status %-${len}.${len}s$errorline\n" "$(basename -- "$file")"
else
if gettarget "$file"; then
echo "$(basename -- "$file")"