Skip to main content

omni_dev/cli/
browser.rs

1//! Browser bridge CLI commands.
2
3pub(crate) mod bridge;
4pub(crate) mod harvest;
5pub(crate) mod request;
6
7use anyhow::Result;
8use clap::{Parser, Subcommand};
9
10/// Browser bridge: drive authenticated requests through a browser tab.
11#[derive(Parser)]
12pub struct BrowserCommand {
13    /// The browser subcommand to execute.
14    #[command(subcommand)]
15    pub command: BrowserSubcommands,
16}
17
18/// Browser subcommands.
19#[derive(Subcommand)]
20pub enum BrowserSubcommands {
21    /// Bridge: run the server (`serve`) or send a request through it (`request`).
22    Bridge(bridge::BridgeCommand),
23}
24
25impl BrowserCommand {
26    /// Executes the browser command.
27    pub async fn execute(self) -> Result<()> {
28        match self.command {
29            BrowserSubcommands::Bridge(cmd) => cmd.execute().await,
30        }
31    }
32}