Skip to content
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

Fix out of scope opt variable #10020

Merged
merged 2 commits into from
Oct 7, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 1 addition & 2 deletions share/functions/ls.fish
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ function ls --description "List contents of directory"
__fish_set_lscolors

isatty stdout
Copy link
Member

@faho faho Sep 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The intention is to apply -F only if the output goes to the terminal. Your patch removes that and makes this isatty ineffectual.

The simplest fix is to set $opt before:

set -l opt
isatty stdout
and set opt -F

Note that we have some cases above where we might apply "-F" even if the output isn't a tty, those should be removed. It's either when we have colorls or when ls doesn't support any of the color flags.

and set -a opt -F

# Terminal.app doesn't set $COLORTERM or $CLICOLOR,
# but the new FreeBSD ls requires either to be set,
Expand All @@ -61,5 +60,5 @@ function ls --description "List contents of directory"
test "$TERM_PROGRAM" = Apple_Terminal
and set -lx CLICOLOR 1

command $__fish_ls_command $__fish_ls_color_opt $opt $argv
command $__fish_ls_command $__fish_ls_color_opt -F $argv
end