Skip to content

Commit

Permalink
ls: Fix formatting/linting/spelling issues
Browse files Browse the repository at this point in the history
  • Loading branch information
RenjiSann committed Nov 19, 2023
1 parent 4283c9f commit 02724fb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
6 changes: 2 additions & 4 deletions src/uu/ls/src/ls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -620,11 +620,9 @@ fn extract_quoting_style(options: &clap::ArgMatches, show_control: bool) -> Quot
QuotingStyle::C {
quotes: quoting_style::Quotes::Double,
}
} else if options.get_flag(options::DIRED) {
QuotingStyle::Literal { show_control }
} else if !std::io::stdout().is_terminal() {
} else if options.get_flag(options::DIRED) || !std::io::stdout().is_terminal() {
// By default, `ls` uses Literal quoting when
// outputing to a non-terminal file descriptor
// writing to a non-terminal file descriptor
QuotingStyle::Literal { show_control }
} else {
// TODO: use environment variable if available
Expand Down
12 changes: 6 additions & 6 deletions tests/by-util/test_ls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2461,8 +2461,8 @@ fn test_ls_quoting_style() {
.arg("one\ntwo")
.succeeds()
.stdout_only("one?two\n");
// TODO: TTY-expected output, find a way to check this as well
// .stdout_only("'one'$'\\n''two'\n");
// TODO: TTY-expected output, find a way to check this as well
// .stdout_only("'one'$'\\n''two'\n");

for (arg, correct) in [
("--quoting-style=literal", "one?two"),
Expand Down Expand Up @@ -2550,8 +2550,8 @@ fn test_ls_quoting_style() {
.arg("one two")
.succeeds()
.stdout_only("one two\n");
// TODO: TTY-expected output
// .stdout_only("'one two'\n");
// TODO: TTY-expected output
// .stdout_only("'one two'\n");

for (arg, correct) in [
("--quoting-style=literal", "one two"),
Expand Down Expand Up @@ -2615,8 +2615,8 @@ fn test_ls_quoting_and_color() {
.arg("one two")
.succeeds()
.stdout_only("one two\n");
// TODO: TTY-expected output
// .stdout_only("'one two'\n");
// TODO: TTY-expected output
// .stdout_only("'one two'\n");
}

#[test]
Expand Down

0 comments on commit 02724fb

Please sign in to comment.