mirror of
https://github.com/uutils/coreutils
synced 2024-07-23 19:04:18 +00:00
ls --dired: v9.5 automatically set --format=long
This commit is contained in:
parent
32c5d23f91
commit
da11981026
|
@ -174,7 +174,6 @@ enum LsError {
|
|||
IOError(std::io::Error),
|
||||
IOErrorContext(std::io::Error, PathBuf, bool),
|
||||
BlockSizeParseError(String),
|
||||
ConflictingArgumentDired,
|
||||
DiredAndZeroAreIncompatible,
|
||||
AlreadyListedError(PathBuf),
|
||||
TimeStyleParseError(String, Vec<String>),
|
||||
|
@ -188,7 +187,6 @@ impl UError for LsError {
|
|||
Self::IOErrorContext(_, _, false) => 1,
|
||||
Self::IOErrorContext(_, _, true) => 2,
|
||||
Self::BlockSizeParseError(_) => 2,
|
||||
Self::ConflictingArgumentDired => 1,
|
||||
Self::DiredAndZeroAreIncompatible => 2,
|
||||
Self::AlreadyListedError(_) => 2,
|
||||
Self::TimeStyleParseError(_, _) => 2,
|
||||
|
@ -204,9 +202,6 @@ impl Display for LsError {
|
|||
Self::BlockSizeParseError(s) => {
|
||||
write!(f, "invalid --block-size argument {}", s.quote())
|
||||
}
|
||||
Self::ConflictingArgumentDired => {
|
||||
write!(f, "--dired requires --format=long")
|
||||
}
|
||||
Self::DiredAndZeroAreIncompatible => {
|
||||
write!(f, "--dired and --zero are incompatible")
|
||||
}
|
||||
|
@ -1084,8 +1079,9 @@ impl Config {
|
|||
};
|
||||
|
||||
let dired = options.get_flag(options::DIRED);
|
||||
if dired && format != Format::Long {
|
||||
return Err(Box::new(LsError::ConflictingArgumentDired));
|
||||
if dired {
|
||||
// --dired implies --format=long
|
||||
format = Format::Long;
|
||||
}
|
||||
if dired && format == Format::Long && options.get_flag(options::ZERO) {
|
||||
return Err(Box::new(LsError::DiredAndZeroAreIncompatible));
|
||||
|
|
|
@ -3929,15 +3929,16 @@ fn test_ls_perm_io_errors() {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn test_ls_dired_incompatible() {
|
||||
fn test_ls_dired_implies_long() {
|
||||
let scene = TestScenario::new(util_name!());
|
||||
|
||||
scene
|
||||
.ucmd()
|
||||
.arg("--dired")
|
||||
.fails()
|
||||
.code_is(1)
|
||||
.stderr_contains("--dired requires --format=long");
|
||||
.succeeds()
|
||||
.stdout_does_not_contain("//DIRED//")
|
||||
.stdout_contains(" total 0")
|
||||
.stdout_contains("//DIRED-OPTIONS// --quoting-style");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
Loading…
Reference in a new issue