zoi_cli/cmd/package/
install.rs1use std::path::PathBuf;
4
5use anyhow::Result;
6use clap::Parser;
7
8use crate::cli::SetupScope;
9
10#[derive(Parser, Debug)]
12pub struct InstallCommand {
13 #[arg(required = true)]
15 pub package_file: PathBuf,
16 #[arg(long, short, num_args = 1..)]
18 pub sub: Option<Vec<String>>,
19 #[arg(long, value_enum, default_value_t = SetupScope::User)]
21 pub scope: SetupScope,
22 #[arg(long)]
24 pub yes: bool
25}
26
27pub fn run(args: InstallCommand) -> Result<()> {
37 let scope = match args.scope {
38 SetupScope::User => crate::pkg::types::Scope::User,
39 SetupScope::System => crate::pkg::types::Scope::System
40 };
41 crate::pkg::install::pkg_install::run(
42 &args.package_file,
43 Some(scope),
44 "local",
45 None,
46 args.yes,
47 args.sub,
48 true,
49 None
50 )?;
51 Ok(())
52}