mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-28 12:45:13 +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,6 +28,15 @@ 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).
|
# 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
|
if not set -q __fish_ls_color_opt
|
||||||
set -g __fish_ls_color_opt
|
set -g __fish_ls_color_opt
|
||||||
|
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
|
for opt in --color=auto -G --color -F
|
||||||
if command ls $opt / >/dev/null 2>/dev/null
|
if command ls $opt / >/dev/null 2>/dev/null
|
||||||
set -g __fish_ls_color_opt $opt
|
set -g __fish_ls_color_opt $opt
|
||||||
|
@ -35,6 +44,7 @@ function ls --description "List contents of directory"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# Set the colors to the default via `dircolors` if none is given.
|
# Set the colors to the default via `dircolors` if none is given.
|
||||||
__fish_set_lscolors
|
__fish_set_lscolors
|
||||||
|
@ -42,10 +52,5 @@ function ls --description "List contents of directory"
|
||||||
isatty stdout
|
isatty stdout
|
||||||
and set -a opt -F
|
and set -a opt -F
|
||||||
|
|
||||||
if command -sq colorls
|
command $__fish_ls_command $__fish_ls_color_opt $argv
|
||||||
command colorls -GF $argv
|
|
||||||
else
|
|
||||||
command ls $__fish_ls_color_opt $argv
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue