add static builder
This commit is contained in:
26
src/cli.rs
26
src/cli.rs
@@ -1,4 +1,4 @@
|
||||
use clap::{Parser, Subcommand};
|
||||
use clap::{Parser, Subcommand, ValueEnum};
|
||||
|
||||
#[derive(Parser)]
|
||||
#[command(name = "olla", about = "Couteau suisse local : réseau, domotique, déploiement, et plus.")]
|
||||
@@ -7,11 +7,35 @@ pub struct Cli {
|
||||
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 },
|
||||
}
|
||||
|
||||
#[derive(Subcommand)]
|
||||
|
||||
Reference in New Issue
Block a user