fix list command

This commit is contained in:
Ferdinand Schober
2025-03-15 17:43:14 +01:00
parent 58383646f8
commit d5ecc0a931
2 changed files with 13 additions and 4 deletions

View File

@@ -5,7 +5,8 @@ use std::{net::IpAddr, time::Duration};
use thiserror::Error;
use lan_mouse_ipc::{
connect_async, ClientHandle, FrontendEvent, FrontendRequest, ConnectionError, IpcError, Position,
connect_async, ClientHandle, ConnectionError, FrontendEvent, FrontendRequest, IpcError,
Position,
};
#[derive(Debug, Error)]
@@ -118,9 +119,17 @@ async fn execute(cmd: CliSubcommand) -> Result<(), CliError> {
tx.request(FrontendRequest::Enumerate()).await?;
while let Some(e) = rx.next().await {
if let FrontendEvent::Enumerate(clients) = e? {
for client in clients {
println!("{client:?}");
for (handle, config, state) in clients {
let host = config.hostname.unwrap_or("unknown".to_owned());
let port = config.port;
let pos = config.pos;
let active = state.active;
let ips = state.ips;
println!(
"id {handle}: {host}:{port} ({pos}) active: {active}, ips: {ips:?}"
);
}
break;
}
}
}

View File

@@ -8,8 +8,8 @@ use lan_mouse::{
emulation_test,
service::{Service, ServiceError},
};
use lan_mouse_ipc::{IpcError, IpcListenerCreationError};
use lan_mouse_cli::CliError;
use lan_mouse_ipc::{IpcError, IpcListenerCreationError};
use std::{
future::Future,
io,