Expand description
sqry daemon subcommand handlers.
Provides lifecycle management for the sqryd daemon from the sqry CLI:
sqry daemon start– resolvesqrydbinary, execsqryd start --detach.sqry daemon stop– connect via [DaemonClient], senddaemon/stop, poll socket gone.sqry daemon status– connect via [DaemonClient], senddaemon/status, render.sqry daemon logs– tail / follow the daemon log file.
Additionally exposes try_auto_start_daemon for future Task 13 wiring into
query commands via the SQRY_DAEMON_AUTO_START=1 opt-in environment variable.
§Tokio runtime
The stop and status subcommands need async I/O for [DaemonClient].
A current_thread runtime is created inside each handler — tokio is already
a transitive dependency of sqry-cli via sqry-lsp.
§Platform notes
try_connect_sync uses std::os::unix::net::UnixStream on Unix and a
named-pipe existence probe on Windows so callers can check reachability
without spinning up a Tokio runtime.
Functions§
- format_
uptime - Format an uptime in seconds as
"Xd Yh Zm"(or shorter when leading units are zero). - human_
bytes - Format a byte count as a human-readable string (B / KB / MB / GB / TB).
- run
- Dispatch a
sqry daemonsubcommand. - tail_
follow - Print the last
initial_lineslines frompath, then follow the file for new content usingnotify::RecommendedWatcher. - tail_
last_ n - Print the last
nlines frompathto stdout. - try_
auto_ start_ daemon - Check whether the daemon auto-start opt-in is active, and if so, try to start the daemon.
- try_
connect_ sync - Synchronously probe whether the daemon socket is reachable.