mirror of
https://github.com/uutils/coreutils.git
synced 2025-12-23 08:47:37 +00:00
Merge pull request #8338 from sylvestre/du-inode
Some checks failed
GnuTests / Run GNU tests (push) Has been cancelled
CICD / Style/cargo-deny (push) Has been cancelled
CICD / Style/deps (push) Has been cancelled
CICD / Documentation/warnings (push) Has been cancelled
CICD / MinRustV (push) Has been cancelled
CICD / Dependencies (push) Has been cancelled
CICD / Code Coverage (push) Has been cancelled
CICD / Separate Builds (push) Has been cancelled
Android / Test builds (push) Has been cancelled
Code Quality / Style/format (push) Has been cancelled
Code Quality / Style/lint (push) Has been cancelled
Code Quality / Style/spelling (push) Has been cancelled
Code Quality / Style/toml (push) Has been cancelled
Code Quality / Style/Python (push) Has been cancelled
Code Quality / Pre-commit hooks (push) Has been cancelled
FreeBSD / Style and Lint (push) Has been cancelled
FreeBSD / Tests (push) Has been cancelled
CICD / Build (push) Has been cancelled
CICD / Build/Makefile (push) Has been cancelled
CICD / Build/stable (push) Has been cancelled
CICD / Build/nightly (push) Has been cancelled
CICD / Binary sizes (push) Has been cancelled
CICD / Tests/BusyBox test suite (push) Has been cancelled
CICD / Tests/Toybox test suite (push) Has been cancelled
CICD / Test all features separately (push) Has been cancelled
CICD / Build/SELinux (push) Has been cancelled
Some checks failed
GnuTests / Run GNU tests (push) Has been cancelled
CICD / Style/cargo-deny (push) Has been cancelled
CICD / Style/deps (push) Has been cancelled
CICD / Documentation/warnings (push) Has been cancelled
CICD / MinRustV (push) Has been cancelled
CICD / Dependencies (push) Has been cancelled
CICD / Code Coverage (push) Has been cancelled
CICD / Separate Builds (push) Has been cancelled
Android / Test builds (push) Has been cancelled
Code Quality / Style/format (push) Has been cancelled
Code Quality / Style/lint (push) Has been cancelled
Code Quality / Style/spelling (push) Has been cancelled
Code Quality / Style/toml (push) Has been cancelled
Code Quality / Style/Python (push) Has been cancelled
Code Quality / Pre-commit hooks (push) Has been cancelled
FreeBSD / Style and Lint (push) Has been cancelled
FreeBSD / Tests (push) Has been cancelled
CICD / Build (push) Has been cancelled
CICD / Build/Makefile (push) Has been cancelled
CICD / Build/stable (push) Has been cancelled
CICD / Build/nightly (push) Has been cancelled
CICD / Binary sizes (push) Has been cancelled
CICD / Tests/BusyBox test suite (push) Has been cancelled
CICD / Tests/Toybox test suite (push) Has been cancelled
CICD / Test all features separately (push) Has been cancelled
CICD / Build/SELinux (push) Has been cancelled
du: create the string into the main thread to avoid some translations issue
This commit is contained in:
commit
0c669c83db
2 changed files with 25 additions and 5 deletions
|
|
@ -92,6 +92,7 @@ struct StatPrinter {
|
|||
time_format: String,
|
||||
line_ending: LineEnding,
|
||||
summarize: bool,
|
||||
total_text: String,
|
||||
}
|
||||
|
||||
#[derive(PartialEq, Clone)]
|
||||
|
|
@ -546,11 +547,7 @@ impl StatPrinter {
|
|||
}
|
||||
|
||||
if self.total {
|
||||
print!(
|
||||
"{}\t{}",
|
||||
self.convert_size(grand_total),
|
||||
get_message("du-total")
|
||||
);
|
||||
print!("{}\t{}", self.convert_size(grand_total), self.total_text);
|
||||
print!("{}", self.line_ending);
|
||||
}
|
||||
|
||||
|
|
@ -779,6 +776,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
time,
|
||||
time_format,
|
||||
line_ending: LineEnding::from_zero_flag(matches.get_flag(options::NULL)),
|
||||
total_text: get_message("du-total"),
|
||||
};
|
||||
|
||||
if stat_printer.inodes
|
||||
|
|
|
|||
|
|
@ -1295,3 +1295,25 @@ fn test_du_inodes_blocksize_ineffective() {
|
|||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_du_inodes_total_text() {
|
||||
let ts = TestScenario::new(util_name!());
|
||||
let at = &ts.fixtures;
|
||||
|
||||
at.mkdir_all("d/d");
|
||||
|
||||
let result = ts.ucmd().arg("--inodes").arg("-c").arg("d").succeeds();
|
||||
|
||||
let lines: Vec<&str> = result.stdout_str().lines().collect();
|
||||
|
||||
assert_eq!(lines.len(), 3);
|
||||
|
||||
let total_line = lines.last().unwrap();
|
||||
assert!(total_line.contains("total"));
|
||||
|
||||
let parts: Vec<&str> = total_line.split('\t').collect();
|
||||
assert_eq!(parts.len(), 2);
|
||||
|
||||
assert!(parts[0].parse::<u64>().is_ok());
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue