From 9aebe0ff9a0da8858df5b8ca2ac89a0f81f369dc Mon Sep 17 00:00:00 2001
From: Salt <rehashedsalt@cock.li>
Date: Thu, 20 Aug 2020 06:07:15 -0500
Subject: [PATCH] Make fs ls fancier if you're in a terminal

---
 firestarter | 30 +++++++++++++++++++++++++++---
 1 file changed, 27 insertions(+), 3 deletions(-)

diff --git a/firestarter b/firestarter
index 674d1e7..312fdfc 100755
--- a/firestarter
+++ b/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
 }