mirror of
https://github.com/feschber/lan-mouse.git
synced 2026-04-09 18:51:28 +03:00
fix list command
This commit is contained in:
@@ -5,7 +5,8 @@ use std::{net::IpAddr, time::Duration};
|
|||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
|
|
||||||
use lan_mouse_ipc::{
|
use lan_mouse_ipc::{
|
||||||
connect_async, ClientHandle, FrontendEvent, FrontendRequest, ConnectionError, IpcError, Position,
|
connect_async, ClientHandle, ConnectionError, FrontendEvent, FrontendRequest, IpcError,
|
||||||
|
Position,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(Debug, Error)]
|
#[derive(Debug, Error)]
|
||||||
@@ -118,9 +119,17 @@ async fn execute(cmd: CliSubcommand) -> Result<(), CliError> {
|
|||||||
tx.request(FrontendRequest::Enumerate()).await?;
|
tx.request(FrontendRequest::Enumerate()).await?;
|
||||||
while let Some(e) = rx.next().await {
|
while let Some(e) = rx.next().await {
|
||||||
if let FrontendEvent::Enumerate(clients) = e? {
|
if let FrontendEvent::Enumerate(clients) = e? {
|
||||||
for client in clients {
|
for (handle, config, state) in clients {
|
||||||
println!("{client:?}");
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ use lan_mouse::{
|
|||||||
emulation_test,
|
emulation_test,
|
||||||
service::{Service, ServiceError},
|
service::{Service, ServiceError},
|
||||||
};
|
};
|
||||||
use lan_mouse_ipc::{IpcError, IpcListenerCreationError};
|
|
||||||
use lan_mouse_cli::CliError;
|
use lan_mouse_cli::CliError;
|
||||||
|
use lan_mouse_ipc::{IpcError, IpcListenerCreationError};
|
||||||
use std::{
|
use std::{
|
||||||
future::Future,
|
future::Future,
|
||||||
io,
|
io,
|
||||||
|
|||||||
Reference in New Issue
Block a user