summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorSanto Cariotti <santo@dcariotti.me>2023-10-15 17:45:49 +0200
committerSanto Cariotti <santo@dcariotti.me>2023-10-15 17:49:46 +0200
commit0bfaadf339bd263c9458e827819e39b10bd925ed (patch)
tree2da8758fb97622a0acd807e13ed45cce4f8ead4f /src/main.rs
Init
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs27
1 files changed, 27 insertions, 0 deletions
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::<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(())
+}