Files
xmpd/xmpd-cliargs/src/lib.rs
MCorange a21295ecc8 Major update
too lazy to describe
2025-12-07 19:46:47 +02:00

38 lines
895 B
Rust

use std::{path::PathBuf, str::FromStr, sync::Arc};
use camino::Utf8PathBuf;
use clap::Parser;
lazy_static::lazy_static!(
pub static ref CLIARGS: Arc<CliArgs> = Arc::new(CliArgs::parse());
);
#[derive(Debug, clap::Parser)]
pub struct CliArgs {
/// Manifest path
#[arg(long, short)]
manifest: Option<camino::Utf8PathBuf>,
/// settings file path
#[arg(long, short, default_value="./settings.toml")]
settings: camino::Utf8PathBuf,
/// Cache dir path
#[arg(long, short)]
cache: Option<camino::Utf8PathBuf>,
/// Debug mode
#[arg(long, short)]
pub debug: bool,
}
impl CliArgs {
pub fn manifest_path(&self) -> Option<Utf8PathBuf> {
self.manifest.clone()
}
pub fn settings_path(&self) -> Utf8PathBuf {
self.settings.clone()
}
pub fn cache_path(&self) -> Option<Utf8PathBuf> {
self.cache.clone()
}
}