Files
olla/src/cli.rs
2026-02-18 17:48:27 +01:00

58 lines
1.4 KiB
Rust

use std::path::PathBuf;
use clap::{Parser, Subcommand, ValueEnum};
#[derive(Parser)]
#[command(name = "olla", about = "Couteau suisse local : réseau, domotique, déploiement, et plus.")]
pub struct Cli {
#[command(subcommand)]
pub command: Commands,
}
#[derive(Clone, Copy, ValueEnum)]
pub enum Site {
#[value(name = "dev.olla.fr")]
DevOllaFr,
}
impl Site {
pub fn build_dir(&self) -> &'static str {
match self {
Site::DevOllaFr => "build/dev.olla.fr",
}
}
pub fn deploy_target(&self) -> &'static str {
match self {
Site::DevOllaFr => "dev.olla.fr:/var/www/dev.olla.fr/",
}
}
}
#[derive(Subcommand)]
pub enum Commands {
/// Navigation entre les bureaux bspwm
#[command(subcommand)]
Desktop(DesktopCommands),
/// Lancer le mode développement (build + watch + serve)
Dev { site: Site },
/// Déployer un site (build + rsync)
Deploy { site: Site },
/// Analyser un export CSV d'index EDF et comparer les tarifs
Edf { csv: PathBuf },
}
#[derive(Subcommand)]
pub enum DesktopCommands {
/// Aller à gauche (Mail→Web, Code→Term)
Left,
/// Aller à droite (Web→Mail, Term→Code)
Right,
/// Aller en haut (Term→Web, Code→Mail)
Up,
/// Aller en bas (Web→Term, Mail→Code)
Down,
/// Basculer vers/depuis Others
Others,
}