From 147186f8dc1a1ef93bf1d81d29ae68eafa752953 Mon Sep 17 00:00:00 2001 From: alemi Date: Sat, 19 Oct 2024 21:57:00 +0200 Subject: [PATCH] feat: allow specifying --debug to dbg all routes --- src/main.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 1ce8545..0a61505 100644 --- a/src/main.rs +++ b/src/main.rs @@ -37,6 +37,10 @@ pub enum PostWomanActions { /// repeat request N times #[arg(long, default_value_t = 1)] repeat: u32, + + /// force debug extractor on all routes + #[arg(long, default_value_t = false)] + debug: bool, }, /// show all registered routes in current collection @@ -89,13 +93,14 @@ async fn main() -> Result<(), PostWomanError> { println!("- {name}: \t{} \t{}", endpoint.method.unwrap_or("GET".into()), endpoint.url); } }, - PostWomanActions::Run { query, parallel, repeat } => { + PostWomanActions::Run { query, parallel, repeat, debug } => { let pattern = regex::Regex::new(&query)?; let mut joinset = tokio::task::JoinSet::new(); let client = Arc::new(config.client); let env = Arc::new(config.env); - for (name, endpoint) in config.route { + for (name, mut endpoint) in config.route { if pattern.find(&name).is_some() { + if debug { endpoint.extract = None }; for i in 0..repeat { let suffix = if repeat > 1 { format!("#{} ", i+1)