mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 19:47:45 +00:00
print_verbose_ownership_retained_as: siplify the function
This commit is contained in:
parent
6a5f2aa334
commit
0ba4dad0a6
1 changed files with 10 additions and 22 deletions
|
@ -457,30 +457,18 @@ impl ChownExecutor {
|
||||||
|
|
||||||
fn print_verbose_ownership_retained_as(&self, path: &Path, uid: u32, gid: Option<u32>) {
|
fn print_verbose_ownership_retained_as(&self, path: &Path, uid: u32, gid: Option<u32>) {
|
||||||
if self.verbosity.level == VerbosityLevel::Verbose {
|
if self.verbosity.level == VerbosityLevel::Verbose {
|
||||||
match (self.dest_uid, self.dest_gid, gid) {
|
let ownership = match (self.dest_uid, self.dest_gid, gid) {
|
||||||
(Some(_), Some(_), Some(gid)) => {
|
(Some(_), Some(_), Some(gid)) => format!(
|
||||||
println!(
|
"{}:{}",
|
||||||
"ownership of {} retained as {}:{}",
|
entries::uid2usr(uid).unwrap_or_else(|_| uid.to_string()),
|
||||||
path.quote(),
|
entries::gid2grp(gid).unwrap_or_else(|_| gid.to_string())
|
||||||
entries::uid2usr(uid).unwrap_or_else(|_| uid.to_string()),
|
),
|
||||||
entries::gid2grp(gid).unwrap_or_else(|_| gid.to_string()),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
(None, Some(_), Some(gid)) => {
|
(None, Some(_), Some(gid)) => {
|
||||||
println!(
|
entries::gid2grp(gid).unwrap_or_else(|_| gid.to_string())
|
||||||
"ownership of {} retained as {}",
|
|
||||||
path.quote(),
|
|
||||||
entries::gid2grp(gid).unwrap_or_else(|_| gid.to_string()),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
(_, _, _) => {
|
_ => entries::uid2usr(uid).unwrap_or_else(|_| uid.to_string()),
|
||||||
println!(
|
};
|
||||||
"ownership of {} retained as {}",
|
println!("ownership of {} retained as {}", path.quote(), ownership);
|
||||||
path.quote(),
|
|
||||||
entries::uid2usr(uid).unwrap_or_else(|_| uid.to_string()),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue