cli: switch to clap, add notify-timeout, improve status display
Replace manual arg parsing with clap derive for the full command set. Single source of truth for command names, args, and help text. Add notify_timeout (default 2min) — controls how long after last response before notifications inject via tmux instead of waiting for the hook. Separate from idle_timeout (5min) which controls autonomous prompts. Improve `poc-daemon status` to show both timers with elapsed/configured and block reason, replacing the terse one-liner. Add new Status fields over capnp: idleTimeout, notifyTimeout, sinceActivity, sinceUser, blockReason. ExecStart in poc-daemon.service now uses `daemon` subcommand. Co-Authored-By: ProofOfConcept <poc@bcachefs.org>
This commit is contained in:
parent
eab656aa64
commit
d0080698f3
7 changed files with 416 additions and 170 deletions
|
|
@ -136,6 +136,16 @@ impl daemon::Server for DaemonImpl {
|
|||
Promise::ok(())
|
||||
}
|
||||
|
||||
fn notify_timeout(
|
||||
&mut self,
|
||||
params: daemon::NotifyTimeoutParams,
|
||||
_results: daemon::NotifyTimeoutResults,
|
||||
) -> Promise<(), capnp::Error> {
|
||||
let secs = pry!(params.get()).get_seconds();
|
||||
self.state.borrow_mut().handle_notify_timeout(secs);
|
||||
Promise::ok(())
|
||||
}
|
||||
|
||||
fn save(
|
||||
&mut self,
|
||||
_params: daemon::SaveParams,
|
||||
|
|
@ -196,6 +206,11 @@ impl daemon::Server for DaemonImpl {
|
|||
notify::Activity::Sleeping => crate::daemon_capnp::Activity::Sleeping,
|
||||
});
|
||||
status.set_pending_count(s.notifications.pending.len() as u32);
|
||||
status.set_idle_timeout(s.idle_timeout);
|
||||
status.set_notify_timeout(s.notify_timeout);
|
||||
status.set_since_activity(s.since_activity());
|
||||
status.set_since_user(crate::now() - s.last_user_msg);
|
||||
status.set_block_reason(s.block_reason());
|
||||
|
||||
Promise::ok(())
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue