Skip to main content

omni_dev/cli/
browser.rs

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