From a2041a3d337afdc236d3c323957c0d581d32234a Mon Sep 17 00:00:00 2001 From: salmonik Date: Mon, 24 Aug 2026 18:39:12 +0200 Subject: Add hosts command, info shows current host+fingerprint, disconnect-before-connect, default port 11525 --- src/bin/client/repl.rs | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'src/bin/client/repl.rs') diff --git a/src/bin/client/repl.rs b/src/bin/client/repl.rs index 40b267e..dd55acc 100644 --- a/src/bin/client/repl.rs +++ b/src/bin/client/repl.rs @@ -273,11 +273,15 @@ impl ClientState { } } "connect" => { + if self.stream.is_some() { + println!("\nAlready connected. Disconnect first."); + continue 'outer; + } let addr_str = if parts.len() < 2 { if let Some(h) = &self.addr { h.clone() } else { - println!("\nNo host specified and no previous connection. Usage: connect :"); + println!("\nNo host specified. Usage: connect :"); continue 'outer; } } else { @@ -590,6 +594,20 @@ impl ClientState { ), Err(e) => println!("\nFailed to forget host: {}", e), } + } + "hosts" => { + let hosts = database::get_all_hosts(&self.conn); + if hosts.is_empty() { + println!("\nNo remembered hosts."); + } else { + println!("\nRemembered hosts:"); + for (host, fp) in &hosts { + match fp { + Some(fp) => println!(" {} - {}", host, fp), + None => println!(" {} - (no fingerprint)", host), + } + } + } } _ => help(), } @@ -752,6 +770,7 @@ fn get_commands() -> Vec { "help".to_string(), "quit".to_string(), "forget-host".to_string(), + "hosts".to_string(), ] } -- cgit v1.2.3