Make fs ls fancier if you're in a terminal
This commit is contained in:
parent
243da4b2d8
commit
9aebe0ff9a
30
firestarter
30
firestarter
@ -140,9 +140,33 @@ fslist() {
|
||||
error "No configuration files found" 70
|
||||
fi
|
||||
# Skip our logs directory
|
||||
[ "$_optlogdir" == "$file" ] && continue
|
||||
if gettarget "$file"; then
|
||||
echo "$(basename -- "$file")"
|
||||
[ -d "$file" ] && continue
|
||||
if [ -t 1 ]; then
|
||||
if gettarget "$file"; then
|
||||
printf "$(basename -- "$file"): \e[32m$_return\e[0m\n"
|
||||
else
|
||||
local targeterror="$?"
|
||||
local errrorline
|
||||
case $targeterror in
|
||||
2)
|
||||
errorline="\e[31mNo matches found"
|
||||
;;
|
||||
50)
|
||||
errorline="\e[33mNot an fsdefaults service"
|
||||
;;
|
||||
51)
|
||||
errorline="\e[35mDisabled"
|
||||
;;
|
||||
*)
|
||||
errorline="\e[31mNot a valid file"
|
||||
;;
|
||||
esac
|
||||
printf "$(basename -- "$file"): $errorline\e[0m\n"
|
||||
fi
|
||||
else
|
||||
if gettarget "$file"; then
|
||||
echo "$(basename -- "$file")"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user