|
|
@ -2,30 +2,24 @@ use std::env;
|
|
|
|
use std::path::Path;
|
|
|
|
use std::path::Path;
|
|
|
|
use tokio::fs;
|
|
|
|
use tokio::fs;
|
|
|
|
|
|
|
|
|
|
|
|
use crate::internal::commands::ShellCommand;
|
|
|
|
use crate::builder::pacman::PacmanUninstallBuilder;
|
|
|
|
use crate::internal::error::SilentUnwrap;
|
|
|
|
|
|
|
|
use crate::internal::exit_code::AppExitCode;
|
|
|
|
use crate::internal::exit_code::AppExitCode;
|
|
|
|
use crate::Options;
|
|
|
|
use crate::{crash, Options};
|
|
|
|
|
|
|
|
|
|
|
|
/// Uninstalls the given packages
|
|
|
|
/// Uninstalls the given packages
|
|
|
|
#[tracing::instrument(level = "trace")]
|
|
|
|
#[tracing::instrument(level = "trace")]
|
|
|
|
pub async fn uninstall(packages: Vec<String>, options: Options) {
|
|
|
|
pub async fn uninstall(packages: Vec<String>, options: Options) {
|
|
|
|
let mut pacman_args = vec!["-Rs"];
|
|
|
|
|
|
|
|
pacman_args.append(&mut packages.iter().map(|s| s.as_str()).collect());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if options.noconfirm {
|
|
|
|
|
|
|
|
pacman_args.push("--noconfirm");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
tracing::debug!("Uninstalling: {:?}", &packages);
|
|
|
|
tracing::debug!("Uninstalling: {:?}", &packages);
|
|
|
|
|
|
|
|
|
|
|
|
ShellCommand::pacman()
|
|
|
|
PacmanUninstallBuilder::default()
|
|
|
|
.elevated()
|
|
|
|
.recursive(true)
|
|
|
|
.args(pacman_args)
|
|
|
|
.no_confirm(options.noconfirm)
|
|
|
|
.wait_success()
|
|
|
|
.packages(&packages)
|
|
|
|
|
|
|
|
.uninstall()
|
|
|
|
.await
|
|
|
|
.await
|
|
|
|
.silent_unwrap(AppExitCode::PacmanError);
|
|
|
|
.unwrap_or_else(|_| {
|
|
|
|
|
|
|
|
crash!(AppExitCode::PacmanError, "Failed to remove packages");
|
|
|
|
tracing::debug!("Uninstalling packages: {:?} exited with code 0", &packages);
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
for package in packages {
|
|
|
|
for package in packages {
|
|
|
|
if Path::new(&format!(
|
|
|
|
if Path::new(&format!(
|
|
|
|