mirror of
https://github.com/uutils/coreutils
synced 2024-07-23 10:54:14 +00:00
ls: --format will override the --dired option
Closes: #6488 Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
This commit is contained in:
parent
cd44a3d1fd
commit
4d705621e6
|
@ -1083,7 +1083,7 @@ impl Config {
|
|||
// --dired implies --format=long
|
||||
format = Format::Long;
|
||||
}
|
||||
if dired && format == Format::Long && options.get_flag(options::ZERO) {
|
||||
if dired && options.get_flag(options::ZERO) {
|
||||
return Err(Box::new(LsError::DiredAndZeroAreIncompatible));
|
||||
}
|
||||
|
||||
|
@ -1211,6 +1211,7 @@ pub fn uu_app() -> Command {
|
|||
options::format::LONG,
|
||||
options::format::ACROSS,
|
||||
options::format::COLUMNS,
|
||||
options::DIRED,
|
||||
]),
|
||||
)
|
||||
.arg(
|
||||
|
@ -1303,7 +1304,8 @@ pub fn uu_app() -> Command {
|
|||
.num_args(0..=1)
|
||||
.default_missing_value("always")
|
||||
.default_value("never")
|
||||
.value_name("WHEN").overrides_with(options::DIRED),
|
||||
.value_name("WHEN")
|
||||
.overrides_with(options::DIRED),
|
||||
)
|
||||
// The next four arguments do not override with the other format
|
||||
// options, see the comment in Config::from for the reason.
|
||||
|
|
|
@ -3969,6 +3969,28 @@ fn test_ls_dired_hyperlink() {
|
|||
.stdout_contains("//DIRED//");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_ls_dired_order_format() {
|
||||
let scene = TestScenario::new(util_name!());
|
||||
let at = &scene.fixtures;
|
||||
at.mkdir("dir");
|
||||
at.touch("dir/a");
|
||||
scene
|
||||
.ucmd()
|
||||
.arg("--dired")
|
||||
.arg("--format=vertical")
|
||||
.arg("-R")
|
||||
.succeeds()
|
||||
.stdout_does_not_contain("//DIRED//");
|
||||
scene
|
||||
.ucmd()
|
||||
.arg("--format=vertical")
|
||||
.arg("--dired")
|
||||
.arg("-R")
|
||||
.succeeds()
|
||||
.stdout_contains("//DIRED//");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_ls_dired_and_zero_are_incompatible() {
|
||||
let scene = TestScenario::new(util_name!());
|
||||
|
|
Loading…
Reference in a new issue