diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2026-02-25 14:41:37 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2026-02-25 14:41:37 +0000 |
| commit | 4fc3b279d3eb86993f7748959a3986be5a6c49a7 (patch) | |
| tree | 364c16ec4e4f69ab1ce342402444abe72324b870 /grasp-audit/src/bin/grasp-audit.rs | |
| parent | 9573bb1b5feaa82dad67f9817ec1e9df9639acdb (diff) | |
show probe help when invoked with no arguments
Diffstat (limited to 'grasp-audit/src/bin/grasp-audit.rs')
| -rw-r--r-- | grasp-audit/src/bin/grasp-audit.rs | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/grasp-audit/src/bin/grasp-audit.rs b/grasp-audit/src/bin/grasp-audit.rs index becc4b2..305e5eb 100644 --- a/grasp-audit/src/bin/grasp-audit.rs +++ b/grasp-audit/src/bin/grasp-audit.rs | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | //! GRASP Audit CLI Tool | 1 | //! GRASP Audit CLI Tool |
| 2 | 2 | ||
| 3 | use clap::{Parser, Subcommand}; | 3 | use clap::{CommandFactory, Parser, Subcommand}; |
| 4 | use grasp_audit::*; | 4 | use grasp_audit::*; |
| 5 | use std::path::PathBuf; | 5 | use std::path::PathBuf; |
| 6 | use std::time::Duration; | 6 | use std::time::Duration; |
| @@ -17,9 +17,9 @@ struct Cli { | |||
| 17 | enum Commands { | 17 | enum Commands { |
| 18 | /// Run a probe/smoke test against a server | 18 | /// Run a probe/smoke test against a server |
| 19 | Probe { | 19 | Probe { |
| 20 | /// Relay URL (e.g., ws://localhost:7000) | 20 | /// Relay URL (e.g., wss://relay.ngit.dev) |
| 21 | #[arg(short, long)] | 21 | #[arg(short, long)] |
| 22 | relay: String, | 22 | relay: Option<String>, |
| 23 | 23 | ||
| 24 | /// Output machine-readable JSON | 24 | /// Output machine-readable JSON |
| 25 | #[arg(long, default_value_t = false)] | 25 | #[arg(long, default_value_t = false)] |
| @@ -94,6 +94,17 @@ async fn main() -> Result<()> { | |||
| 94 | nsec, | 94 | nsec, |
| 95 | create_repo, | 95 | create_repo, |
| 96 | } => { | 96 | } => { |
| 97 | let relay = match relay { | ||
| 98 | Some(r) => r, | ||
| 99 | None => { | ||
| 100 | // Print probe-specific help and exit cleanly | ||
| 101 | let mut cmd = Cli::command(); | ||
| 102 | let _ = cmd.find_subcommand_mut("probe").unwrap().print_help(); | ||
| 103 | println!(); | ||
| 104 | return Ok(()); | ||
| 105 | } | ||
| 106 | }; | ||
| 107 | |||
| 97 | // Parse nsec if provided | 108 | // Parse nsec if provided |
| 98 | let keys = if let Some(nsec_str) = nsec { | 109 | let keys = if let Some(nsec_str) = nsec { |
| 99 | use nostr_sdk::prelude::SecretKey; | 110 | use nostr_sdk::prelude::SecretKey; |