chore: initialiser le projet imagod-web (Rust)
- Structure du projet Cargo avec dépendances (clap, axum, reqwest, rusqlite, arboard, tray-icon) - CLI avec sous-commandes start, serve, stop, status, config, install, uninstall, logs - Module config: parsing TOML, chemins Windows/Linux - Module dedup: dédoublonnage SHA-256 avec cache SQLite - Module imago_client: client HTTP pour API Imago (upload, search, get) - Module watcher: boucle de polling stub - Module server: serveur web axum avec routes API REST stub - Platform-specific: clipboard, tray, service, window_info (Windows) - Frontend placeholder HTML - Config par défaut (imagod.toml) - README.md, LICENSE (MIT), .gitignore
This commit is contained in:
+80
@@ -0,0 +1,80 @@
|
||||
//! 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)]
|
||||
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()
|
||||
}
|
||||
Reference in New Issue
Block a user