mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-14 14:03:58 +00:00
ls: Ignore ruby colorls
Apart from OpenBSD's "colorls" that is basically an ls that can do color, there's also a ruby tool called "colorls" that's closer to exa. Ignore that one since the options it understands are quite different and I'm betting it's slower (given my experience with ruby tools). See #8042.
This commit is contained in:
parent
344bd63e0b
commit
a633889244
1 changed files with 15 additions and 10 deletions
|
@ -28,10 +28,20 @@ function ls --description "List contents of directory"
|
|||
# Also test -F because we'll want to define this function even with an ls that can't do colors (like NetBSD).
|
||||
if not set -q __fish_ls_color_opt
|
||||
set -g __fish_ls_color_opt
|
||||
for opt in --color=auto -G --color -F
|
||||
if command ls $opt / >/dev/null 2>/dev/null
|
||||
set -g __fish_ls_color_opt $opt
|
||||
break
|
||||
set -g __fish_ls_command ls
|
||||
# OpenBSD ships a command called "colorls" that takes "-G" and "-F",
|
||||
# but there's also a ruby implementation that doesn't understand "-F".
|
||||
# Since that one's quite different, don't use it.
|
||||
if command -sq colorls
|
||||
and command colorls -GF >/dev/null 2>/dev/null
|
||||
set -g __fish_ls_color_opt -GF
|
||||
set -g __fish_ls_command colorls
|
||||
else
|
||||
for opt in --color=auto -G --color -F
|
||||
if command ls $opt / >/dev/null 2>/dev/null
|
||||
set -g __fish_ls_color_opt $opt
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -42,10 +52,5 @@ function ls --description "List contents of directory"
|
|||
isatty stdout
|
||||
and set -a opt -F
|
||||
|
||||
if command -sq colorls
|
||||
command colorls -GF $argv
|
||||
else
|
||||
command ls $__fish_ls_color_opt $argv
|
||||
end
|
||||
|
||||
command $__fish_ls_command $__fish_ls_color_opt $argv
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue