1mod artifact;
2mod download;
3mod env;
4mod install;
5mod manfiest;
6mod tool;
7mod ty;
8
9use clap::Parser;
10use tool::add_output_to_path;
11
12#[derive(Parser, Debug, Clone)]
13#[command(version, about, long_about = None)]
14pub struct Args {
15 #[arg()]
16 pub url: String,
17
18 #[arg(short, long)]
19 dir: Option<String>,
20
21 #[arg(long, default_value_t = false)]
22 install_only: bool,
23
24 #[arg(long, value_delimiter = ',')]
25 bin: Vec<String>,
26}
27
28pub async fn run_main(args: Args) {
29 let Args {
30 url,
31 dir,
32 install_only,
33 bin,
34 } = args;
35 let output = install::install(&url, &bin, dir).await;
36 if !install_only {
37 add_output_to_path(&output);
38 }
39 if output.is_empty() {
40 println!("No file installed from {}", url);
41 }
42}