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 <noreply@anthropic.com>
This commit is contained in:
@@ -13,6 +13,12 @@ pub struct Cli {
|
||||
pub ticket: Option<String>,
|
||||
|
||||
// ── 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,
|
||||
|
||||
+10
@@ -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| {
|
||||
|
||||
Reference in New Issue
Block a user