-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ls.fish is not setting the --color=auto option #9
Comments
Here is #
# Make ls use colors and show indicators if we are on a system that supports that feature and writing to stdout.
#
# BSD, macOS and others support colors with ls -G.
# GNU ls and FreeBSD ls takes --color=auto. Order of this test is important because ls also takes -G but it has a different meaning.
# Solaris 11's ls command takes a --color flag.
# Also test -F because we'll want to define this function even with an ls that can't do colors (like NetBSD).
for opt in --color=auto -G --color -F
if command ls $opt / >/dev/null 2>/dev/null
function ls --description "List contents of directory" -V opt
isatty stdout
and set -a opt -F
command ls $opt $argv
end
if [ $opt = --color=auto ] && ! set -qx LS_COLORS && set -l cmd (command -s {g,}dircolors)[1]
set -l colorfile
for file in ~/.dir_colors ~/.dircolors /etc/DIR_COLORS
if test -f $file
set colorfile $file
break
end
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 ($cmd -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]
end
end
break
end
end This comment may help in figuring this out. |
It looks like the function ls --description "List contents of directory" -V opt
isatty stdout
and set -a opt -F
command ls $opt $argv
end in the users |
Actually the the function ls --description 'List contents of directory'
set -l opt --color=auto
isatty stdout
and set -a opt -F
command ls $opt $argv
end Note the |
Are you trying to compare the same fish versions? xxh-shell-fish has fish 3.1.0 version. What is your local version? |
I changed the title, as ls.fish is present. There seems to be something in its logic that does not work with the portable setup. It is a bit complicated as the Fish shell programmers were trying to accommodate three different versions of
The local version is exactly the same 3.1.0. |
I noticed that on remote host the
ls
directory listing were not in color.In hunting this down I found that fish has a wrapper function for
ls
calledls.fish
. On a remote host doing:functions ls
return nothing, but it should return the location and code of the function. I builtfish-portable
from its repository following the instructions to get it running and then do:If I create a
ls.fish
function in thefunctions
folder and then run ls the directory listings are back in color.Any idea as to whether
ls.fish
is being included inportable-fish
or if it is just not finding it for some reason?The text was updated successfully, but these errors were encountered: