From c09790ab28eb3e06491015bef234e2f4322ec3be Mon Sep 17 00:00:00 2001 From: alemi Date: Sun, 20 Oct 2024 05:13:03 +0200 Subject: [PATCH] feat: pw shows compact list, pw list shows verbose --- src/main.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main.rs b/src/main.rs index a1e0e91..17ef1bd 100644 --- a/src/main.rs +++ b/src/main.rs @@ -36,7 +36,7 @@ pub enum PostWomanActions { query: String, /// run requests in parallel - #[arg(long, default_value_t = false)] + #[arg(short, long, default_value_t = false)] parallel: bool, /// force debug extractor on all routes @@ -46,9 +46,9 @@ pub enum PostWomanActions { /// show all registered routes in current collection List { - /// show verbose details for each route + /// show only limited details for each route #[arg(short, long, default_value_t = false)] - verbose: bool, + compact: bool, }, } @@ -117,15 +117,15 @@ fn load_collections(store: &mut HashMap, mut path: store.insert(name, collection); } -const DEFAULT_ACTION: PostWomanActions = PostWomanActions::List { verbose: false }; +const DEFAULT_ACTION: PostWomanActions = PostWomanActions::List { compact: true }; type RunResult = (Result, String, String, chrono::DateTime); async fn run_postwoman(args: &PostWomanArgs, namespace: String, collection: PostWomanCollection, pool: &mut tokio::task::JoinSet) { let action = args.action.as_ref().unwrap_or(&DEFAULT_ACTION); match action { - PostWomanActions::List { verbose } => { println!("> {name}"); + PostWomanActions::List { compact } => { for (key, value) in collection.env { println!("+ {key}: {}", ext::stringify_toml(&value)); @@ -135,7 +135,7 @@ async fn run_postwoman(args: &PostWomanArgs, namespace: String, collection: Post for (name, mut endpoint) in collection.route { println!("- {name}: \t{} \t{}", endpoint.method.as_deref().unwrap_or("GET"), endpoint.url); - if *verbose { + if ! *compact { if let Some(ref query) = endpoint.query { for query in query { println!(" |? {query}");