boot-tree: palette options, finished-run timeline, readable unit names, repaint on reconnect, handover frame

This commit is contained in:
Willem Vanhulle committed 2026-10-11 15:54:28 +02:00
1 parent 1482d4437a
commit 101d7bae89
16 files changed
+854 -292

No files matched your search

+32 -6
View File
@@ -6,9 +6,11 @@ mod run;
mod sysroot;
mod systemd;
use std::{process::ExitCode, time::Duration};
use std::{fs, io::ErrorKind, path::PathBuf, process::ExitCode, time::Duration};
use boot_tree::palette::Config;
use clap::Parser;
use jiff::SignedDuration;
use crate::{
run::{Options, run},
@@ -27,20 +29,44 @@ struct Cli {
target: Option<String>,
#[arg(
long,
default_value_t = 0,
help = "Milliseconds to keep the final frame on screen"
default_value = "1s",
value_parser = parse_duration,
help = "How long the final frame stays on screen, e.g. 1s or 500ms"
)]
hold_ms: u64,
hold: Duration,
#[arg(
long,
default_value = "/etc/boot-tree.toml",
help = "TOML file with a [palette] table"
)]
config: PathBuf,
}
fn parse_duration(raw: &str) -> Result<Duration, String> {
let signed: SignedDuration = raw.parse().map_err(|error| format!("{error}"))?;
Duration::try_from(signed).map_err(|error| format!("{error}"))
}
fn main() -> ExitCode {
let cli = Cli::parse();
let config = match fs::read_to_string(&cli.config) {
Ok(text) => toml::from_str(&text).unwrap_or_else(|error| {
eprintln!("boot-tree: ignoring {}: {error}", cli.config.display());
Config::default()
}),
Err(error) if error.kind() == ErrorKind::NotFound => Config::default(),
Err(error) => {
eprintln!("boot-tree: cannot read {}: {error}", cli.config.display());
Config::default()
}
};
let options = Options {
scope: if cli.user { Scope::User } else { Scope::System },
target: cli.target,
hold: Duration::from_millis(cli.hold_ms),
hold: cli.hold,
palette: config.palette,
};
match run(options) {
match run(&options) {
Ok(()) => ExitCode::SUCCESS,
Err(error) => {
eprintln!("boot-tree: {error}");