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/database.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/bin/client/database.rs') diff --git a/src/bin/client/database.rs b/src/bin/client/database.rs index 55051fb..e1fa42d 100644 --- a/src/bin/client/database.rs +++ b/src/bin/client/database.rs @@ -104,3 +104,15 @@ pub fn forget_host(conn: &Connection, host: &str) -> Result<(), rusqlite::Error> conn.execute("DELETE FROM credentials WHERE host = ?1", [host])?; Ok(()) } + +/// List all remembered hosts with their fingerprints. +pub fn get_all_hosts(conn: &Connection) -> Vec<(String, Option)> { + let mut stmt = conn + .prepare("SELECT host, fingerprint FROM hosts ORDER BY last_used DESC") + .unwrap(); + let rows = stmt.query_map([], |row| { + Ok((row.get(0)?, row.get(1)?)) + }) + .unwrap(); + rows.filter_map(|r| r.ok()).collect() +} -- cgit v1.2.3