2025-07-27 16:12:20 -04:00
|
|
|
use clap::Parser;
|
|
|
|
|
|
|
|
|
|
#[derive(Parser, Debug, Clone)]
|
|
|
|
|
#[command(version, about, long_about = None)]
|
|
|
|
|
pub struct CliArgs {
|
|
|
|
|
/// TCP port on which to accept connections
|
|
|
|
|
#[arg(short, long, default_value_t = 8001)]
|
|
|
|
|
pub port: u16,
|
|
|
|
|
|
|
|
|
|
/// IP Address on which to accept connections
|
|
|
|
|
#[arg(long, default_value_t = {"127.0.0.1".to_string()})]
|
|
|
|
|
pub ip: String,
|
|
|
|
|
|
|
|
|
|
/// Assets root
|
|
|
|
|
#[arg(long, default_value_t = {"../assets/robocraft".to_string()})]
|
|
|
|
|
pub assets_robocraft: String,
|
|
|
|
|
|
|
|
|
|
/// User data root
|
|
|
|
|
#[arg(long, default_value_t = {"../data/robocraft".to_string()})]
|
|
|
|
|
pub data_robocraft: String,
|
2025-10-27 22:07:38 -04:00
|
|
|
|
|
|
|
|
/// Verify configuration and then exit
|
|
|
|
|
#[arg(long)]
|
|
|
|
|
pub validate: bool,
|
2026-07-14 17:59:05 -04:00
|
|
|
|
|
|
|
|
/// Rate limit incoming federated auth requests
|
|
|
|
|
#[arg(long)]
|
|
|
|
|
pub chill: bool,
|
2025-07-27 16:12:20 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl CliArgs {
|
|
|
|
|
pub fn get() -> Self {
|
|
|
|
|
Self::parse()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub async fn preloaded(self) -> crate::robocraft::RcConfig {
|
|
|
|
|
crate::robocraft::RcConfig::from_args(&self).await
|
|
|
|
|
}
|
|
|
|
|
}
|