Start to implement energy consumption backend

This commit is contained in:
2024-06-29 10:11:31 +02:00
parent 9d3e2beb81
commit 49a3e3a669
8 changed files with 66 additions and 2 deletions

View File

@ -1,6 +1,24 @@
use clap::Parser;
use clap::{Parser, Subcommand};
use std::path::{Path, PathBuf};
/// Electrical consumption fetcher backend
#[derive(Subcommand, Debug, Clone)]
pub enum ConsumptionBackend {
/// Constant consumption value
Constant {
#[clap(long, default_value_t = 500)]
value: i32,
},
/// Generate random consumption value
Random {
#[clap(long, default_value_t = -5000)]
min: i32,
#[clap(long, default_value_t = 20000)]
max: i32,
},
}
/// Solar system central backend
#[derive(Parser, Debug)]
#[command(version, about, long_about = None)]
@ -20,6 +38,10 @@ pub struct AppConfig {
/// Server storage path
#[arg(short, long, env, default_value = "storage")]
storage: String,
/// Consumption backend provider
#[clap(subcommand)]
pub consumption_backend: Option<ConsumptionBackend>,
}
lazy_static::lazy_static! {