vdev/commands/build/
vector.rs1use std::process::Command;
2
3use anyhow::Result;
4use clap::Args;
5
6use crate::{app::CommandExt as _, platform};
7
8#[derive(Args, Debug)]
10#[command()]
11pub struct Cli {
12 target: Option<String>,
14
15 #[arg(short, long)]
17 release: bool,
18
19 #[arg(short = 'F', long)]
21 feature: Vec<String>,
22}
23
24impl Cli {
25 pub fn exec(self) -> Result<()> {
26 let mut command = Command::new("cargo");
27 command.in_repo();
28 command.arg("build");
29
30 if self.release {
31 command.arg("--release");
32 }
33
34 command.features(&self.feature);
35
36 let target = self.target.unwrap_or_else(platform::default_target);
37 command.args(["--target", &target]);
38
39 waiting!("Building Vector");
40 command.check_run()?;
41
42 Ok(())
43 }
44}