adjust formatting of output for todoperbackend.show()

This commit is contained in:
timeshifter
2023-02-03 11:42:33 +01:00
parent 220dc26389
commit 43f8c659d4
2 changed files with 8 additions and 9 deletions
+1 -4
View File
@@ -65,15 +65,12 @@ impl ToDoPerBackend {
Ok(()) Ok(())
} }
pub(crate) fn show(&self, keyword: Option<&str>) { pub(crate) fn show(&self) {
for (backend, packages) in self.iter() { for (backend, packages) in self.iter() {
if packages.is_empty() { if packages.is_empty() {
continue; continue;
} }
if let Some(kw) = keyword {
println!("Would {kw} the following packages:");
}
println!(" [{}]", backend.get_section()); println!(" [{}]", backend.get_section());
for package in packages { for package in packages {
println!(" {package}"); println!(" {package}");
+5 -3
View File
@@ -96,7 +96,8 @@ impl Pacdef {
return Ok(()); return Ok(());
} }
to_install.show("install".into()); println!("Would install the following packages:");
to_install.show();
if !get_user_confirmation()? { if !get_user_confirmation()? {
return Ok(()); return Ok(());
@@ -141,7 +142,7 @@ impl Pacdef {
fn show_unmanaged_packages(mut self) { fn show_unmanaged_packages(mut self) {
let unmanaged_per_backend = &self.get_unmanaged_packages(); let unmanaged_per_backend = &self.get_unmanaged_packages();
unmanaged_per_backend.show(None); unmanaged_per_backend.show();
} }
fn get_unmanaged_packages(&mut self) -> ToDoPerBackend { fn get_unmanaged_packages(&mut self) -> ToDoPerBackend {
@@ -176,7 +177,8 @@ impl Pacdef {
return Ok(()); return Ok(());
} }
to_remove.show("remove".into()); println!("Would remove the following packages");
to_remove.show();
if !get_user_confirmation()? { if !get_user_confirmation()? {
return Ok(()); return Ok(());