|
|
@ -1,31 +1,13 @@
|
|
|
|
use crate::internal::{commands::ShellCommand, error::AppResult, structs::Options};
|
|
|
|
use crate::internal::{commands::ShellCommand, error::AppResult, structs::Options};
|
|
|
|
|
|
|
|
|
|
|
|
pub struct PacmanWrapper;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
impl PacmanWrapper {
|
|
|
|
|
|
|
|
pub async fn install(args: PacmanInstallArgs) -> AppResult<()> {
|
|
|
|
|
|
|
|
let mut command = ShellCommand::pacman().elevated().arg("-S").arg("--needed");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if args.no_confirm {
|
|
|
|
|
|
|
|
command = command.arg("--noconfirm")
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if args.as_deps {
|
|
|
|
|
|
|
|
command = command.arg("--asdeps")
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
command.args(args.packages).wait_success().await
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[derive(Debug, Default)]
|
|
|
|
#[derive(Debug, Default)]
|
|
|
|
pub struct PacmanInstallArgs {
|
|
|
|
pub struct PacmanInstallBuilder {
|
|
|
|
packages: Vec<String>,
|
|
|
|
packages: Vec<String>,
|
|
|
|
as_deps: bool,
|
|
|
|
as_deps: bool,
|
|
|
|
no_confirm: bool,
|
|
|
|
no_confirm: bool,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
impl PacmanInstallArgs {
|
|
|
|
impl PacmanInstallBuilder {
|
|
|
|
pub fn from_options(options: Options) -> Self {
|
|
|
|
pub fn from_options(options: Options) -> Self {
|
|
|
|
Self::default()
|
|
|
|
Self::default()
|
|
|
|
.as_deps(options.asdeps)
|
|
|
|
.as_deps(options.asdeps)
|
|
|
@ -50,4 +32,19 @@ impl PacmanInstallArgs {
|
|
|
|
|
|
|
|
|
|
|
|
self
|
|
|
|
self
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[tracing::instrument(level = "debug")]
|
|
|
|
|
|
|
|
pub async fn install(self) -> AppResult<()> {
|
|
|
|
|
|
|
|
let mut command = ShellCommand::pacman().elevated().arg("-S").arg("--needed");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if self.no_confirm {
|
|
|
|
|
|
|
|
command = command.arg("--noconfirm")
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if self.as_deps {
|
|
|
|
|
|
|
|
command = command.arg("--asdeps")
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
command.args(self.packages).wait_success().await
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|