finga
0434505b2d
Check several possible standard paths when there is no path to the configuration file given as argument. To find the configuration file following paths are used. The local directory `./config.toml`, the user global configuration directory `$XDG_CONFIG_HOME/whakarite/config.toml` and the system wide configuration directory `/etc/whakarite/config.toml`. Note that in the later two cases the directory which contains the `config.toml` receives its name from the `$CARGO_BIN_NAME` environment variable at compile time.
16 lines
375 B
Rust
16 lines
375 B
Rust
use clap::Parser;
|
|
use std::path::PathBuf;
|
|
use tracing::Level;
|
|
|
|
#[derive(Parser)]
|
|
#[command(author, version, about)]
|
|
pub struct Args {
|
|
/// Use a custom config file
|
|
#[arg(short, long, value_name = "FILE")]
|
|
pub config: Option<PathBuf>,
|
|
|
|
/// Set a log level
|
|
#[arg(short, long, value_name = "LEVEL", default_value_t = Level::INFO)]
|
|
pub log_level: Level,
|
|
}
|