upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/grasp-audit/src/bin
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2025-11-19 17:01:36 +0000
committerDanConwayDev <DanConwayDev@protonmail.com>2025-11-19 17:01:36 +0000
commitbf7f4d5381203d5c27b2811d62c5b1781533aa2b (patch)
tree26903bbf535d83abd7242370d8b6932eb80e3389 /grasp-audit/src/bin
parentfa065ad128882755f2a988d6203b59a2ab5e38ff (diff)
fix some clippy fmt warnings
Diffstat (limited to 'grasp-audit/src/bin')
-rw-r--r--grasp-audit/src/bin/grasp-audit.rs36
1 files changed, 21 insertions, 15 deletions
diff --git a/grasp-audit/src/bin/grasp-audit.rs b/grasp-audit/src/bin/grasp-audit.rs
index 6c063db..b56a8e3 100644
--- a/grasp-audit/src/bin/grasp-audit.rs
+++ b/grasp-audit/src/bin/grasp-audit.rs
@@ -18,11 +18,11 @@ enum Commands {
18 /// Relay URL (e.g., ws://localhost:7000) 18 /// Relay URL (e.g., ws://localhost:7000)
19 #[arg(short, long)] 19 #[arg(short, long)]
20 relay: String, 20 relay: String,
21 21
22 /// Mode: ci or production 22 /// Mode: ci or production
23 #[arg(short, long, default_value = "ci")] 23 #[arg(short, long, default_value = "ci")]
24 mode: String, 24 mode: String,
25 25
26 /// Spec to test (nip01-smoke, all) 26 /// Spec to test (nip01-smoke, all)
27 #[arg(short, long, default_value = "nip01-smoke")] 27 #[arg(short, long, default_value = "nip01-smoke")]
28 spec: String, 28 spec: String,
@@ -35,12 +35,12 @@ async fn main() -> Result<()> {
35 tracing_subscriber::fmt() 35 tracing_subscriber::fmt()
36 .with_env_filter( 36 .with_env_filter(
37 tracing_subscriber::EnvFilter::from_default_env() 37 tracing_subscriber::EnvFilter::from_default_env()
38 .add_directive(tracing::Level::INFO.into()) 38 .add_directive(tracing::Level::INFO.into()),
39 ) 39 )
40 .init(); 40 .init();
41 41
42 let cli = Cli::parse(); 42 let cli = Cli::parse();
43 43
44 match cli.command { 44 match cli.command {
45 Commands::Audit { relay, mode, spec } => { 45 Commands::Audit { relay, mode, spec } => {
46 let config = match mode.as_str() { 46 let config = match mode.as_str() {
@@ -48,7 +48,7 @@ async fn main() -> Result<()> {
48 "production" => AuditConfig::production(), 48 "production" => AuditConfig::production(),
49 _ => return Err(anyhow!("Invalid mode: {}. Use 'ci' or 'production'", mode)), 49 _ => return Err(anyhow!("Invalid mode: {}. Use 'ci' or 'production'", mode)),
50 }; 50 };
51 51
52 println!("🔍 GRASP Audit Tool"); 52 println!("🔍 GRASP Audit Tool");
53 println!("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"); 53 println!("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━");
54 println!("Relay: {}", relay); 54 println!("Relay: {}", relay);
@@ -57,17 +57,18 @@ async fn main() -> Result<()> {
57 println!("Run ID: {}", config.run_id); 57 println!("Run ID: {}", config.run_id);
58 println!("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"); 58 println!("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━");
59 println!(); 59 println!();
60 60
61 println!("Connecting to relay..."); 61 println!("Connecting to relay...");
62 let client = AuditClient::new(&relay, config).await 62 let client = AuditClient::new(&relay, config)
63 .await
63 .map_err(|e| anyhow!("Failed to connect to relay: {}", e))?; 64 .map_err(|e| anyhow!("Failed to connect to relay: {}", e))?;
64 65
65 if !client.is_connected().await { 66 if !client.is_connected().await {
66 return Err(anyhow!("Could not establish connection to relay")); 67 return Err(anyhow!("Could not establish connection to relay"));
67 } 68 }
68 69
69 println!("✓ Connected\n"); 70 println!("✓ Connected\n");
70 71
71 let results = match spec.as_str() { 72 let results = match spec.as_str() {
72 "nip01-smoke" => { 73 "nip01-smoke" => {
73 println!("Running NIP-01 smoke tests...\n"); 74 println!("Running NIP-01 smoke tests...\n");
@@ -77,11 +78,16 @@ async fn main() -> Result<()> {
77 println!("Running all tests...\n"); 78 println!("Running all tests...\n");
78 specs::Nip01SmokeTests::run_all(&client).await 79 specs::Nip01SmokeTests::run_all(&client).await
79 } 80 }
80 _ => return Err(anyhow!("Unknown spec: {}. Use 'nip01-smoke' or 'all'", spec)), 81 _ => {
82 return Err(anyhow!(
83 "Unknown spec: {}. Use 'nip01-smoke' or 'all'",
84 spec
85 ))
86 }
81 }; 87 };
82 88
83 results.print_report(); 89 results.print_report();
84 90
85 if !results.all_passed() { 91 if !results.all_passed() {
86 println!("❌ Some tests failed"); 92 println!("❌ Some tests failed");
87 std::process::exit(1); 93 std::process::exit(1);
@@ -90,6 +96,6 @@ async fn main() -> Result<()> {
90 } 96 }
91 } 97 }
92 } 98 }
93 99
94 Ok(()) 100 Ok(())
95} 101}