diff options
Diffstat (limited to 'crates/dinggerd/src/main.rs')
| -rw-r--r-- | crates/dinggerd/src/main.rs | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/crates/dinggerd/src/main.rs b/crates/dinggerd/src/main.rs index 7cf3513..fced7c2 100644 --- a/crates/dinggerd/src/main.rs +++ b/crates/dinggerd/src/main.rs @@ -72,6 +72,12 @@ enum Command { /// Restore only these sessions. #[arg(long = "session")] sessions: Vec<String>, + /// Write the report to restore.log and notify a summary. + #[arg(long)] + report: bool, + /// Stop offering the saved layout (it can still be restored). + #[arg(long)] + dismiss: bool, }, /// Install integrations: an agent's hook extension (state and session /// reports), or `zsh` (command lines for restore to retype). @@ -90,11 +96,16 @@ enum ManifestCommand { } fn main() { + platform::default_sigpipe(); + let cli = Cli::parse(); + // The daemon logs its work; commands print their own output and only + // log problems. + let default_level = if matches!(cli.command, Command::Watch { .. }) { "info" } else { "warn" }; tracing_subscriber::fmt() - .with_env_filter(EnvFilter::try_from_default_env().unwrap_or_else(|_| "info".into())) + .with_env_filter(EnvFilter::try_from_default_env().unwrap_or_else(|_| default_level.into())) .init(); - match Cli::parse().command { + match cli.command { Command::Watch { interval_secs, no_sounds, @@ -134,8 +145,14 @@ fn main() { // Best effort: a stopped watcher just means nothing to wake. let _ = hooks::poke(); } - Command::Restore { dry_run, list, from, sessions } => { - let result = if list { restore::list() } else { restore::run(from.as_deref(), &sessions, dry_run) }; + Command::Restore { dry_run, list, from, sessions, report, dismiss } => { + let result = if list { + restore::list() + } else if dismiss { + restore::dismiss() + } else { + restore::run(from.as_deref(), &sessions, dry_run, report) + }; if let Err(err) = result { eprintln!("dingger: {err}"); std::process::exit(1); |
