//! Parsing CLI avec clap use clap::{Parser, Subcommand}; #[derive(Parser)] #[command( name = "imagod-web", version = env!("CARGO_PKG_VERSION"), about = "Imago Daemon + Dashboard — Capture automatique de screenshots + Dashboard web embarqué", long_about = "Service de capture automatique de screenshots vers Imago avec dashboard web embarqué.\n\n\ Modes :\n \ Windows : imagod-web start → watcher clipboard + dashboard :9090\n \ Linux : imagod-web serve --port 9090 --no-watcher → dashboard uniquement" )] pub struct Args { #[command(subcommand)] pub command: Command, } #[derive(Subcommand)] pub enum Command { /// Lancer le watcher + dashboard (Windows uniquement) Start { /// Port du dashboard web #[arg(long, default_value = "9090")] port: u16, /// Ouvrir le dashboard dans le navigateur #[arg(long)] open_browser: bool, }, /// Lancer le dashboard web uniquement (Linux/serveur) Serve { /// Port du dashboard web #[arg(long, default_value = "9090")] port: u16, /// Interface d'écoute #[arg(long, default_value = "127.0.0.1")] host: String, /// Désactiver le watcher clipboard #[arg(long)] no_watcher: bool, /// Ouvrir le dashboard dans le navigateur #[arg(long)] open_browser: bool, }, /// Arrêter le service Stop, /// Afficher l'état du service Status, /// Gérer la configuration Config { #[command(subcommand)] action: ConfigAction, }, /// Installer comme service Windows Install, /// Désinstaller le service Windows Uninstall, /// Afficher les derniers logs Logs, } #[derive(Subcommand, Debug)] pub enum ConfigAction { /// Afficher la configuration actuelle Show, /// Modifier un paramètre Set { /// Clé de configuration (ex: imago.url) key: String, /// Valeur value: String, }, /// Réinitialiser la configuration par défaut Reset, } pub fn parse() -> Args { Args::parse() }