saltfish/src/config/args.rs
fabolous005 85e5522950
All checks were successful
CI / Saltfish (push) Successful in -2m38s
CI / Saltfish [custom_pieces] (push) Successful in -2m40s
commits from last night: enlarge get_config() function
2024-04-06 04:35:22 +02:00

66 lines
1.3 KiB
Rust

use std::path::PathBuf;
#[derive(clap::Parser, Debug)]
pub struct Args {
#[arg(short, long="config", default_value = "config.toml")]
config_path: Option<PathBuf>,
#[arg(short, long)]
depth: Option<u8>,
#[arg(short, long)]
strenght: Option<u8>,
#[arg(short, long)]
jobs: Option<u8>,
#[arg(long, value_parser =
clap::builder::PossibleValuesParser::new(["trace", "debug", "info", "warn", "error"])
)]
log_level: Option<String>,
#[arg(long)]
log_file: Option<PathBuf>,
}
impl Default for Args {
fn default() -> Self {
Self {
config_path: Some("config.toml".into()),
depth: None,
strenght: None,
jobs: None,
log_level: None,
log_file: None,
}
}
}
impl Args {
pub fn get_config_path(&self) -> Option<PathBuf> {
self.config_path.clone()
}
pub fn get_depth(&self) -> Option<u8> {
self.depth
}
pub fn get_strenght(&self) -> Option<u8> {
self.strenght
}
pub fn get_jobs(&self) -> Option<u8> {
self.jobs
}
pub fn get_log_level(&self) -> Option<String> {
self.log_level.clone()
}
pub fn get_log_file(&self) -> Option<PathBuf> {
self.log_file.clone()
}
}