From 0bfaadf339bd263c9458e827819e39b10bd925ed Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Sun, 15 Oct 2023 17:45:49 +0200 Subject: Init --- src/main.rs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/main.rs (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..893b9f5 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,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::>(); + + let mut command = Command::new(params[0]); + if params.len() > 1 { + for arg in ¶ms[1..] { + command.arg(arg); + } + } + let pid = exec(&mut command)?; + trace(pid)?; + + Ok(()) +} -- cgit v1.2.3-18-g5258