use crate::auth::AuthedClient; use crate::ui; use anyhow::{anyhow, Result}; use rsh_types::{ConnectionView, OpReq, OpResp}; pub async fn list(client: &AuthedClient, session: Option) -> Result<()> { let conns = fetch(client, session).await?; if conns.is_empty() { ui::print_info("no connections"); } else { println!("{}", ui::connections_table(&conns)); } Ok(()) } pub async fn fetch(client: &AuthedClient, session: Option) -> Result> { match client.req(OpReq::ConnectionList { session }).await? { OpResp::Connections(c) => Ok(c), OpResp::Err(e) => Err(anyhow!(e)), other => Err(anyhow!("unexpected: {other:?}")), } }