use clap::Subcommand; use std::path::PathBuf; #[derive(Subcommand)] pub enum WebCommand { #[command(name = "web-start")] Start { #[arg(short, long, default_value = "11438")] port: u16, #[arg(short, long)] file: Option, #[arg(short = 'H', long, help = "User home directory for data storage (default: current user's home)")] home: Option, }, } pub async fn handle_web_command(cmd: WebCommand) -> anyhow::Result<()> { match cmd { WebCommand::Start { port, file, home } => { let home = home.unwrap_or_else(|| dirs::home_dir().unwrap_or_else(|| PathBuf::from("."))); log::info!("Using home directory: {}", home.display()); crate::server::run(port, file, home).await?; } } Ok(()) }