mirror of
https://github.com/postgresml/pgcat.git
synced 2026-03-25 10:06:28 +00:00
Add cmd line parser (#512)
This commit adds the clap library and configures the necessary args to parse from the command line, expanding the current option of a single file and adding support for environment variables. Signed-off-by: Sebastian Webber <sebastian@swebber.me>
This commit is contained in:
17
src/cmd_args.rs
Normal file
17
src/cmd_args.rs
Normal file
@@ -0,0 +1,17 @@
|
||||
use clap::Parser;
|
||||
use log::LevelFilter;
|
||||
|
||||
/// PgCat: Nextgen PostgreSQL Pooler
|
||||
#[derive(Parser, Debug)]
|
||||
#[command(author, version, about, long_about = None)]
|
||||
pub(crate) struct Args {
|
||||
#[arg(default_value_t = String::from("pgcat.toml"), env)]
|
||||
pub config_file: String,
|
||||
|
||||
#[arg(short, long, default_value_t = LevelFilter::Info, env)]
|
||||
pub log_level: log::LevelFilter,
|
||||
}
|
||||
|
||||
pub(crate) fn parse() -> Args {
|
||||
return Args::parse();
|
||||
}
|
||||
Reference in New Issue
Block a user