From 6619bc9b0f83356e80e72fdc6ac894fdb50eac54 Mon Sep 17 00:00:00 2001 From: Mollusk Date: Sun, 24 May 2026 16:15:07 -0400 Subject: [PATCH] feat(cli): --host flag for headless hosting Hosting was only reachable through the interactive dialoguer menu; there was no way to start a host non-interactively. Add a --host flag that runs host::run directly (interactive=false), bypassing the menu. Useful for scripting and required by the upcoming --gui front-end, which drives this binary as a child process. Guards against --host + ticket (contradictory). Co-Authored-By: Claude Opus 4.7 --- src/cli.rs | 6 ++++++ src/main.rs | 10 ++++++++++ 2 files changed, 16 insertions(+) diff --git a/src/cli.rs b/src/cli.rs index 41bb49b..ca21ddf 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -13,6 +13,12 @@ pub struct Cli { pub ticket: Option, // ── host options ────────────────────────────────────────────────── + /// Run as host without the interactive menu. Equivalent to picking + /// "Host" in the menu, but headless — for scripting and the --gui + /// front-end, which drives this binary as a child process. + #[arg(long)] + pub host: bool, + /// Pick a single window instead of the whole screen. #[arg(long)] pub window: bool, diff --git a/src/main.rs b/src/main.rs index 4ff0406..35013bd 100644 --- a/src/main.rs +++ b/src/main.rs @@ -28,6 +28,16 @@ async fn main() -> Result<()> { return interactive::run_reconfigure().await; } + if cli.host { + if cli.ticket.is_some() { + anyhow::bail!( + "--host and a ticket argument are mutually exclusive: --host shares your \ + screen, a ticket views someone else's." + ); + } + return host::run(cli.into_host_opts(false)).await; + } + match cli.ticket.as_deref() { Some(s) => { let ticket: EndpointTicket = s.parse().map_err(|e| {