summaryrefslogtreecommitdiff
path: root/src/main.rs
blob: 893b9f5fde033926b6478713f0161876ddab53ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
mod trace;

use crate::trace::{exec, trace};
use clap::Parser;
use std::process::Command;

#[derive(Parser)]
#[command(author, version, about, long_about = None)]
struct Args {
    command: String,
}

fn main() -> anyhow::Result<()> {
    let args = Args::parse();
    let params = args.command.split(' ').collect::<Vec<&str>>();

    let mut command = Command::new(params[0]);
    if params.len() > 1 {
        for arg in &params[1..] {
            command.arg(arg);
        }
    }
    let pid = exec(&mut command)?;
    trace(pid)?;

    Ok(())
}