use std::path::PathBuf; use clap::{command, Parser, Subcommand}; use serde::Serialize; #[derive(Parser, Serialize)] #[command(version, about, long_about = None)] pub(crate) struct Opts { /// The Immich API URL - it should probably end in "/api" #[arg(short, long)] #[serde(skip_serializing_if = "::std::option::Option::is_none")] pub server_url: Option, /// The Immich API key #[arg(short, long)] #[serde(skip_serializing_if = "::std::option::Option::is_none")] pub api_key: Option, /// If enabled, actions that would have been performed are only logged #[arg(short, long)] pub dry_run: bool, #[command(subcommand)] #[serde(flatten)] pub command: Commands, } #[derive(Serialize, Subcommand)] pub(crate) enum Commands { /// Assets related commands #[serde(rename = "assets")] Assets { #[command(subcommand)] #[serde(flatten)] assets_command: AssetsCommands, }, /// People related commands #[serde(rename = "people")] People { #[command(subcommand)] #[serde(flatten)] people_command: PeopleCommands, }, /// Server related commands #[serde(rename = "server")] Server { #[command(subcommand)] #[serde(flatten)] server_command: ServerCommands, }, } #[derive(Serialize, Subcommand)] pub(crate) enum AssetsCommands { /// List all assets #[serde(rename = "list")] List { /// List only offline assets #[arg(short, long, action)] offline: bool, }, } #[derive(Serialize, Subcommand)] pub(crate) enum PeopleCommands { /// Synchronises date of births from a vcard file #[serde(rename = "sync_date_of_births")] SyncDateOfBirths { #[arg(short, long)] #[serde(skip_serializing_if = "::std::option::Option::is_none")] vcard: Option, }, /// Lists the people without date of birth #[serde(rename = "missing_date_of_births")] MissingDateOfBirths {}, } #[derive(Serialize, Subcommand)] pub(crate) enum ServerCommands { /// Checks which server features are enabled #[serde(rename = "features")] Features {}, /// Fetches the version of the server #[serde(rename = "version")] Version {}, }