summaryrefslogtreecommitdiffstats
path: root/src/main.rs
diff options
context:
space:
mode:
authorToby Vincent <tobyv13@gmail.com>2023-03-19 20:55:12 -0500
committerToby Vincent <tobyv13@gmail.com>2023-03-19 21:22:13 -0500
commit928995171b8f3f19df96cfd5870f7e88f11c3978 (patch)
tree157e81951b38ae7024b702cd3bf911ac1bf3b951 /src/main.rs
parentb9890b578d8bcdb0d0a9c12ba3901b4e34514286 (diff)
feat: impl ssh KnownHosts file source
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/main.rs b/src/main.rs
index 7534bb1..2357ab2 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -2,7 +2,7 @@ use std::collections::HashMap;
use clap::Parser;
-use sshr::{Config, History, Session, SessionSource, Timestamp, Tmux};
+use sshr::{Config, History, Session, SessionSource, Tmux};
fn main() -> anyhow::Result<()> {
let config = Config::parse();
@@ -20,7 +20,10 @@ fn main() -> anyhow::Result<()> {
}
fn list_sessions(config: Config) -> anyhow::Result<()> {
- let mut sessions: HashMap<String, Timestamp> = HashMap::new();
+ let mut sessions = HashMap::new();
+
+ let ssh = ssh2::Session::new()?;
+ sessions = ssh.update(sessions)?;
let tmux = Tmux::new(config.socket_name);
sessions = tmux.update(sessions)?;
@@ -31,10 +34,7 @@ fn list_sessions(config: Config) -> anyhow::Result<()> {
}
}
- let mut sessions: Vec<Session> = sessions
- .into_iter()
- .map(|(name, timestamp)| Session { name, timestamp })
- .collect();
+ let mut sessions: Vec<Session> = sessions.into_values().collect();
sessions.sort();