vdev/commands/
exec.rs

1use std::process::Command;
2
3use anyhow::Result;
4use clap::Args;
5
6use crate::app::CommandExt as _;
7
8/// Execute a command within the repository
9#[derive(Args, Debug)]
10#[command()]
11pub struct Cli {
12    #[arg(required = true, trailing_var_arg = true, allow_hyphen_values = true)]
13    args: Vec<String>,
14}
15
16impl Cli {
17    pub fn exec(self) -> Result<()> {
18        let status = Command::new(&self.args[0])
19            .in_repo()
20            .args(&self.args[1..])
21            .run()?;
22        std::process::exit(status.code().unwrap_or(1));
23    }
24}