progress: add format variants
for iterating over a single group, or iterating just on the group level Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
parent
fc8920e35d
commit
f867ef9c4a
@ -795,6 +795,23 @@ impl StoreProgress {
|
|||||||
|
|
||||||
impl std::fmt::Display for StoreProgress {
|
impl std::fmt::Display for StoreProgress {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
|
if self.group_snapshots == 0 {
|
||||||
|
write!(
|
||||||
|
f,
|
||||||
|
"{:.2}% ({} of {} groups)",
|
||||||
|
self.percentage() * 100.0,
|
||||||
|
self.done_groups,
|
||||||
|
self.total_groups,
|
||||||
|
)
|
||||||
|
} else if self.total_groups == 1 {
|
||||||
|
write!(
|
||||||
|
f,
|
||||||
|
"{:.2}% ({} of {} snapshots)",
|
||||||
|
self.percentage() * 100.0,
|
||||||
|
self.done_snapshots,
|
||||||
|
self.group_snapshots,
|
||||||
|
)
|
||||||
|
} else {
|
||||||
write!(
|
write!(
|
||||||
f,
|
f,
|
||||||
"{:.2}% ({} of {} groups, {} of {} group snapshots)",
|
"{:.2}% ({} of {} groups, {} of {} group snapshots)",
|
||||||
@ -805,4 +822,5 @@ impl std::fmt::Display for StoreProgress {
|
|||||||
self.group_snapshots,
|
self.group_snapshots,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user