Enhance installation process, update service paths, and improve device classification
This commit is contained in:
parent
edb2ba338a
commit
55d103b3cf
12 changed files with 323 additions and 70 deletions
|
|
@ -3,6 +3,10 @@ name = "bread-cli"
|
|||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[[bin]]
|
||||
name = "bread"
|
||||
path = "src/main.rs"
|
||||
|
||||
[dependencies]
|
||||
bread-shared = { path = "../bread-shared" }
|
||||
serde.workspace = true
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ use serde_json::{json, Value};
|
|||
use std::env;
|
||||
use std::io;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::time::{Duration, UNIX_EPOCH};
|
||||
use std::time::Duration;
|
||||
use tokio::io::{AsyncBufReadExt, AsyncWriteExt, BufReader};
|
||||
use tokio::net::UnixStream;
|
||||
use tokio::sync::mpsc;
|
||||
|
|
@ -331,18 +331,6 @@ fn print_reload(value: &Value) {
|
|||
}
|
||||
}
|
||||
|
||||
async fn watch_reload(socket: &Path) -> Result<()> {
|
||||
let config_dir = config_directory();
|
||||
println!("watching {} for changes...", config_dir.display());
|
||||
|
||||
let (tx, mut rx) = mpsc::unbounded_channel();
|
||||
let mut watcher: RecommendedWatcher = notify::recommended_watcher(move |res| {
|
||||
let _ = tx.send(res);
|
||||
})?;
|
||||
watcher.watch(&config_dir, RecursiveMode::Recursive)?;
|
||||
|
||||
use tokio::time::{sleep, Duration};
|
||||
|
||||
async fn watch_reload(socket: &Path) -> Result<()> {
|
||||
let config_dir = config_directory();
|
||||
println!("watching {} for changes...", config_dir.display());
|
||||
|
|
@ -360,7 +348,7 @@ async fn watch_reload(socket: &Path) -> Result<()> {
|
|||
|
||||
// Debounce: drain any follow-up events that arrive within 150ms.
|
||||
// A single file save typically generates 2-3 fs events in rapid succession.
|
||||
sleep(Duration::from_millis(150)).await;
|
||||
tokio::time::sleep(Duration::from_millis(150)).await;
|
||||
while rx.try_recv().is_ok() {}
|
||||
|
||||
let response = send_request(socket, "modules.reload", json!({})).await?;
|
||||
|
|
@ -370,9 +358,6 @@ async fn watch_reload(socket: &Path) -> Result<()> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn print_doctor(socket: &Path) -> Result<()> {
|
||||
let stream = match UnixStream::connect(socket).await {
|
||||
Ok(stream) => stream,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue