mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 05:13:10 +00:00
Add color to ls output on OpenBSD when colorls is installed (#8035)
* add support for colorized ls on openbsd * add changelog line for colorls support * add readme line for colorls support * determine ls command at runtime, don't cache it * eliminate __fish_ls_command function
This commit is contained in:
parent
83a11dda3f
commit
3ddb5a2bdc
3 changed files with 10 additions and 1 deletions
|
@ -51,6 +51,7 @@ Interactive improvements
|
|||
- ``wait`` and ``on-process-exit`` work correctly with jobs that have already exited (:issue:`7210`).
|
||||
- Completion scripts are now loaded when calling a command via a relative path (like ``./git``) (:issue:`6001`, :issue:`7992`).
|
||||
- ``__fish_print_help`` (used for ``--help`` output for fish's builtins) now respects $LESS and uses a better default value (:issue:`7997`).
|
||||
- ls output is colorized on OpenBSD if colorls utility is installed (:issue:`8035`)
|
||||
- The default pager color looks better in terminals with light backgrounds (:issue:`3412`).
|
||||
- Further robustness improvements to the bash history import (:issue:`7874`).
|
||||
|
||||
|
|
|
@ -104,6 +104,7 @@ The following optional features also have specific requirements:
|
|||
``wl-copy``/``wl-paste`` or ``pbcopy``/``pbpaste`` utilities
|
||||
- full completions for ``yarn`` and ``npm`` require the
|
||||
``all-the-package-names`` NPM module
|
||||
- ``colorls`` is used, if its installed, to add color when running ``ls``
|
||||
|
||||
Switching to fish
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
|
|
@ -24,6 +24,7 @@ function ls --description "List contents of directory"
|
|||
# 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.
|
||||
# OpenBSD requires the separate colorls program for color support.
|
||||
# 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
|
||||
|
@ -40,5 +41,11 @@ function ls --description "List contents of directory"
|
|||
|
||||
isatty stdout
|
||||
and set -a opt -F
|
||||
command ls $__fish_ls_color_opt $argv
|
||||
|
||||
if command -sq colorls
|
||||
command colorls $__fish_ls_color_opt $argv
|
||||
else
|
||||
command ls $__fish_ls_color_opt $argv
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue