1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-27 19:17:43 +00:00

Merge pull request #2413 from deantvv/ls-show-control-if-tty

ls: set show-control-char if stdout is terminal
This commit is contained in:
Sylvestre Ledru 2021-06-18 18:26:22 +02:00 committed by GitHub
commit 54ccfdfd9f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -382,10 +382,11 @@ impl Config {
#[allow(clippy::needless_bool)] #[allow(clippy::needless_bool)]
let show_control = if options.is_present(options::HIDE_CONTROL_CHARS) { let show_control = if options.is_present(options::HIDE_CONTROL_CHARS) {
false false
} else if options.is_present(options::SHOW_CONTROL_CHARS) { } else if options.is_present(options::SHOW_CONTROL_CHARS) || atty::is(atty::Stream::Stdout)
{
true true
} else { } else {
false // TODO: only if output is a terminal and the program is `ls` false
}; };
let quoting_style = if let Some(style) = options.value_of(options::QUOTING_STYLE) { let quoting_style = if let Some(style) = options.value_of(options::QUOTING_STYLE) {