use crate::cli::SetupScope;
use anyhow::Result;
use clap::Parser;
use std::path::PathBuf;
#[derive(Parser, Debug)]
pub struct InstallCommand {
#[arg(required = true)]
pub package_file: PathBuf,
#[arg(long, short, num_args = 1..)]
pub sub: Option<Vec<String>>,
#[arg(long, value_enum, default_value_t = SetupScope::User)]
pub scope: SetupScope,
#[arg(long)]
pub yes: bool,
}
pub fn run(args: InstallCommand) -> Result<()> {
let scope = match args.scope {
SetupScope::User => crate::pkg::types::Scope::User,
SetupScope::System => crate::pkg::types::Scope::System,
};
crate::pkg::install::pkg_install::run(
&args.package_file,
Some(scope),
"local",
None,
args.yes,
args.sub,
true,
None,
)?;
Ok(())
}