mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-03 06:41:14 -03:00
@@ -12,7 +12,15 @@ if command ls --version >/dev/null 2>/dev/null
|
||||
end
|
||||
|
||||
if not set -q LS_COLORS
|
||||
if command -sq dircolors
|
||||
set -l dircolors
|
||||
for d in gdircolors dircolors
|
||||
if command -sq $d
|
||||
set dircolors $d
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
if set -q dircolors[1]
|
||||
set -l colorfile
|
||||
for file in ~/.dir_colors ~/.dircolors /etc/DIR_COLORS
|
||||
if test -f $file
|
||||
@@ -22,7 +30,7 @@ if command ls --version >/dev/null 2>/dev/null
|
||||
end
|
||||
# Here we rely on the legacy behavior of `dircolors -c` producing output suitable for
|
||||
# csh in order to extract just the data we're interested in.
|
||||
set -gx LS_COLORS (dircolors -c $colorfile | string split ' ')[3]
|
||||
set -gx LS_COLORS ($dircolors -c $colorfile | string split ' ')[3]
|
||||
# The value should always be quoted but be conservative and check first.
|
||||
if string match -qr '^([\'"]).*\1$' -- $LS_COLORS
|
||||
set LS_COLORS (string match -r '^.(.*).$' $LS_COLORS)[2]
|
||||
|
||||
Reference in New Issue
Block a user