zero-trust-rps 0.0.5

Online Multiplayer Rock Paper Scissors
Documentation
use std::{net::IpAddr, num::NonZeroU64};

use clap::Parser;

use crate::cli_utils::CLAP_LONG_VERSION;
use crate::common::constants::{DEFAULT_PORT, LOCALHOST};

#[derive(Parser)]
#[command(version, about, long_about = None)]
#[command(propagate_version = true)]
#[command(long_version = CLAP_LONG_VERSION)]
pub struct ClientOptions {
    #[arg(long, required(false), requires("domain"))]
    pub ip: Option<IpAddr>,
    #[arg(long, default_value_t = DEFAULT_PORT)]
    pub port: u16,
    #[arg(long, default_value = LOCALHOST)]
    pub domain: String,
    #[arg(long, default_value_t = false)]
    pub hide_inputs: bool,
    #[arg(long, default_value_t = 30)]
    timeout: u64,
}

impl ClientOptions {
    pub fn get_timeout(&self) -> Option<NonZeroU64> {
        NonZeroU64::new(self.timeout)
    }
}