pub async fn spawn_cli(db: DB, server_start: Instant, shutdown_tx: Sender<bool>)Expand description
Spawns the CLI in a separate blocking thread.
Runs an interactive command loop that listens for user input and dispatches commands to their respective handlers. The CLI operates on a dedicated thread to avoid blocking the async Tokio runtime, allowing the server to continue handling HTTP requests concurrently.
Session expiry is enforced—after 20 minutes of inactivity, users must re-authenticate
with server:login before executing protected commands.
The CLI automatically exits when a shutdown signal is received via shutdown_tx.
§Arguments
db- A reference to the database connection, passed to all command handlers.server_start- The instant when the server started, used for uptime calculations inserver:status.shutdown_tx- A watch channel sender that signals the CLI to exit when the server is shutting down.
§Example
let (shutdown_tx, shutdown_rx) = tokio::sync::watch::channel(false);
cli::spawn_cli(db, server_start, shutdown_tx).await;