zoi/cmd/package/
install.rs1use crate::cli::SetupScope;
2use anyhow::Result;
3use clap::Parser;
4use std::path::PathBuf;
5
6#[derive(Parser, Debug)]
7pub struct InstallCommand {
8 #[arg(required = true)]
10 pub package_file: PathBuf,
11 #[arg(long, short, num_args = 1..)]
13 pub sub: Option<Vec<String>>,
14 #[arg(long, value_enum, default_value_t = SetupScope::User)]
16 pub scope: SetupScope,
17 #[arg(long)]
19 pub yes: bool,
20}
21
22pub fn run(args: InstallCommand) -> Result<()> {
23 let scope = match args.scope {
24 SetupScope::User => crate::pkg::types::Scope::User,
25 SetupScope::System => crate::pkg::types::Scope::System,
26 };
27 crate::pkg::package::install::run(
28 &args.package_file,
29 Some(scope),
30 "local",
31 None,
32 args.yes,
33 args.sub,
34 )?;
35 Ok(())
36}