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

ls: set show-control-char if stdout is terminal

This commit is contained in:
Dean Li 2021-06-15 21:47:36 +08:00
parent 83a8ec1a67
commit c73ba1630e
No known key found for this signature in database
GPG key ID: 4F55BB69D480672A

View file

@ -382,10 +382,11 @@ impl Config {
#[allow(clippy::needless_bool)]
let show_control = if options.is_present(options::HIDE_CONTROL_CHARS) {
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
} 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) {