diff --git a/Cargo.toml b/Cargo.toml index e99fa89..feda670 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,7 +8,7 @@ edition = "2021" [dependencies] btleplug = "0.10.4" -clap = { version = "4.1.6", features = ["derive"] } +clap = { version = "4.1.6", features = ["derive", "cargo"] } console = "0.15.5" futures = "0.3.26" indicatif = { version = "0.17.3", features = ["tokio"] } diff --git a/src/ble.rs b/src/ble.rs index 79ec9c5..ebfe5db 100644 --- a/src/ble.rs +++ b/src/ble.rs @@ -7,6 +7,7 @@ use btleplug::api::{ BDAddr, Central, CentralEvent, Manager as _, Peripheral as _, ScanFilter, WriteType, }; use btleplug::platform::{Adapter, Manager, Peripheral}; +use clap::{crate_name, crate_version}; use console::Term; use futures::stream::StreamExt; use tokio::time; @@ -169,9 +170,12 @@ pub async fn send( pub async fn repl(adapter_name: String, address: String) -> Result<(), Box> { let term = Term::stdout(); + term.write_line(format!("{} {}", crate_name!(), crate_version!()).as_str())?; + term.write_line(format!("Connecting to... {}", address).as_str())?; let device = find_device_by_address(adapter_name, address).await?; device.connect().await?; if device.is_connected().await? { + term.write_line("Connected. Type quit() to exit.")?; device.discover_services().await?; let line_channel = get_stdin_line_channel();