mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-27 19:17:43 +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
2 changed files with 26 additions and 2 deletions
|
@ -1083,7 +1083,7 @@ impl Config {
|
||||||
// --dired implies --format=long
|
// --dired implies --format=long
|
||||||
format = 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));
|
return Err(Box::new(LsError::DiredAndZeroAreIncompatible));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1211,6 +1211,7 @@ pub fn uu_app() -> Command {
|
||||||
options::format::LONG,
|
options::format::LONG,
|
||||||
options::format::ACROSS,
|
options::format::ACROSS,
|
||||||
options::format::COLUMNS,
|
options::format::COLUMNS,
|
||||||
|
options::DIRED,
|
||||||
]),
|
]),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
|
@ -1303,7 +1304,8 @@ pub fn uu_app() -> Command {
|
||||||
.num_args(0..=1)
|
.num_args(0..=1)
|
||||||
.default_missing_value("always")
|
.default_missing_value("always")
|
||||||
.default_value("never")
|
.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
|
// The next four arguments do not override with the other format
|
||||||
// options, see the comment in Config::from for the reason.
|
// options, see the comment in Config::from for the reason.
|
||||||
|
|
|
@ -3969,6 +3969,28 @@ fn test_ls_dired_hyperlink() {
|
||||||
.stdout_contains("//DIRED//");
|
.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]
|
#[test]
|
||||||
fn test_ls_dired_and_zero_are_incompatible() {
|
fn test_ls_dired_and_zero_are_incompatible() {
|
||||||
let scene = TestScenario::new(util_name!());
|
let scene = TestScenario::new(util_name!());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue