use std::net::{IpAddr, Ipv4Addr, SocketAddr};
use clap::{Args, Subcommand};
#[derive(Debug, Args)]
pub(crate) struct AppArgs {
#[command(subcommand)]
pub command: AppCommand,
}
#[derive(Debug, Subcommand)]
pub(crate) enum AppCommand {
Run(AppRunArgs),
}
#[derive(Debug, Args)]
pub(crate) struct AppRunArgs {
pub file: String,
#[arg(long, value_name = "UI_URI")]
pub resource: Option<String>,
#[arg(long, value_name = "ADDR", default_value = "127.0.0.1:0")]
pub bind: SocketAddr,
#[arg(long = "no-open", action = clap::ArgAction::SetFalse, default_value_t = true)]
pub open: bool,
}
impl Default for AppRunArgs {
fn default() -> Self {
Self {
file: String::new(),
resource: None,
bind: SocketAddr::new(IpAddr::V4(Ipv4Addr::LOCALHOST), 0),
open: true,
}
}
}