feat: add the possibility to put unwanted packages to lists and update gnome extra list
This commit is contained in:
32
src/main.rs
32
src/main.rs
@@ -238,15 +238,15 @@ fn manage_list(list: String, remove: bool) -> Result<()> {
|
||||
let packages = list
|
||||
.lines()
|
||||
.map(|line| line.trim())
|
||||
.filter(|line| !line.is_empty())
|
||||
.filter(|line| !line.is_empty() && !line.starts_with('#') && !line.starts_with('-'))
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
let mut dnf_cmd = std::process::Command::new("dnf");
|
||||
if remove {
|
||||
log::info!("Removing common list...");
|
||||
log::info!("Removing wanted list's packages...");
|
||||
dnf_cmd.arg("remove");
|
||||
} else {
|
||||
log::info!("Installing common list...");
|
||||
log::info!("Installing wanted list's packages...");
|
||||
dnf_cmd.arg("install").arg("--allowerasing");
|
||||
}
|
||||
|
||||
@@ -256,6 +256,32 @@ fn manage_list(list: String, remove: bool) -> Result<()> {
|
||||
|
||||
dnf_cmd.status()?;
|
||||
|
||||
let packages = list
|
||||
.lines()
|
||||
.map(|line| line.trim())
|
||||
.filter(|line| !line.is_empty() && !line.starts_with('#') && line.starts_with('-'))
|
||||
.map(|line| line.trim_start_matches('-').trim())
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
if packages.is_empty() {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
let mut dnf_cmd = std::process::Command::new("dnf");
|
||||
if remove {
|
||||
log::info!("Re-installing unwanted list's packages...");
|
||||
dnf_cmd.arg("install").arg("--allowerasing");
|
||||
} else {
|
||||
log::info!("Removing unwanted list's packages...");
|
||||
dnf_cmd.arg("remove");
|
||||
}
|
||||
|
||||
packages.iter().for_each(|package| {
|
||||
dnf_cmd.arg(package);
|
||||
});
|
||||
|
||||
dnf_cmd.status()?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user