//! Command line surface. use std::path::PathBuf; use clap::{Parser, Subcommand}; #[derive(Debug, Parser)] #[command( name = "calcalist", version, about = "Aggregate and sync events between CalDAV, Google Calendar and iCal feeds" )] pub struct Cli { /// Configuration file (default: $XDG_CONFIG_HOME/calcalist/calcalist.toml) #[arg(long, short, global = true, value_name = "FILE")] pub config: Option, #[command(subcommand)] pub command: Command, } #[derive(Debug, Subcommand)] pub enum Command { /// Run one synchronisation cycle Sync { /// Report what would change without writing anything #[arg(long)] dry_run: bool, /// Proceed even when the mass-deletion guard trips #[arg(long)] force: bool, }, /// Show endpoints, aggregates and the last sync result Status, /// Serve the configuration web interface on localhost Serve { #[arg(long, default_value_t = 8723)] port: u16, }, /// Google account operations Google { #[command(subcommand)] command: GoogleCommand, }, /// Aggregate maintenance Aggregate { #[command(subcommand)] command: AggregateCommand, }, /// Check that the environment and configuration are usable Doctor, } #[derive(Debug, Subcommand)] pub enum GoogleCommand { /// Authorise calcalist against a Google account Login { /// Endpoint id to authorise endpoint: String, }, } #[derive(Debug, Subcommand)] pub enum AggregateCommand { /// Move an aggregate to a different target endpoint Retarget { /// Aggregate id id: String, /// Endpoint id to publish the aggregate to from now on #[arg(long = "to", value_name = "ENDPOINT")] to: String, /// Leave mirrored events on the previous target (default) #[arg(long, conflicts_with = "purge_old")] keep_old: bool, /// Delete calcalist's mirrored events from the previous target #[arg(long)] purge_old: bool, }, }