summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDylan Araps <dylan.araps@gmail.com>2019-01-13 14:32:07 +0200
committerDylan Araps <dylan.araps@gmail.com>2019-01-13 14:32:07 +0200
commitfd6c01ecce6918c277c91d5e975ccba484f37a21 (patch)
tree79b704e3fa8f8dec985bb93563fb3e9e87205198
parent1f125d4bcc98d25817ec9402246cc1e5429e90e7 (diff)
support for LS_COLORS
-rwxr-xr-xfff7
1 files changed, 7 insertions, 0 deletions
diff --git a/fff b/fff
index bea8b95..f4ee79c 100755
--- a/fff
+++ b/fff
@@ -74,11 +74,17 @@ get_ls_colors() {
# Parse the LS_COLORS variable and source each file type
# as a separate variable.
# Format: :*.ext=0;0:*.jpg=0;0;0:
+ [[ -z $LS_COLORS ]] && {
+ FFF_LS_COLORS=0
+ return
+ }
+
ls_cols="${LS_COLORS//\*./file_}"
ls_cols="${ls_cols//=/=\'}"
ls_cols="${ls_cols//:/\';}"
# bash 3 compatible method of sourcing a variable.
+ # shellcheck source=/dev/null
source /dev/stdin <<< "$ls_cols"
}
@@ -167,6 +173,7 @@ print_line() {
format+="\\e[${so:-01;35}m"
elif [[ $file_ext != "$file_name" ]]; then
+ file_ext="${file_ext//=}"
file_ext="file_${file_ext//-}"
format+="\\e[${!file_ext:-37}m"