use std::net::{Ipv4Addr, SocketAddrV4};
use clap::{Parser, Subcommand};
use super::RESOLVED_CLIENT_PORT;
#[derive(Parser, Debug)]
#[command(version)]
pub struct Arguments {
#[command(subcommand)]
pub command: Commands,
#[command(flatten)]
pub client_config: Option<ClientConfig>,
}
#[derive(Parser, Debug)]
pub struct ClientConfig {
#[arg(long)]
pub interface: Option<String>,
#[arg(long)]
pub listen_address: Option<SocketAddrV4>,
}
impl Default for ClientConfig {
fn default() -> Self {
Self {
interface: None,
listen_address: Some(SocketAddrV4::new(
Ipv4Addr::new(0, 0, 0, 0),
RESOLVED_CLIENT_PORT,
)),
}
}
}
impl ClientConfig {
pub fn merge(self, other: Self) -> Self {
Self {
interface: self.interface.or(other.interface),
listen_address: self.listen_address.or(other.listen_address),
}
}
}
#[derive(Subcommand, Debug)]
pub enum Commands {
Dora {},
Release {},
Inform {},
Decline {},
}