synchronize default values with documentation; add more precise help descriptions

This commit is contained in:
Mario Voigt 2025-02-18 11:44:47 +01:00
parent c8f0337c1e
commit 9ec515d0bf
2 changed files with 18 additions and 15 deletions

View File

@ -152,13 +152,13 @@ impl Default for Config {
actor_connections: vec![("Testmachine".to_string(), "Actor".to_string())], actor_connections: vec![("Testmachine".to_string(), "Actor".to_string())],
init_connections: vec![("Initiator".to_string(), "Testmachine".to_string())], init_connections: vec![("Initiator".to_string(), "Testmachine".to_string())],
db_path: PathBuf::from("/run/bffh/database"), db_path: PathBuf::from("/var/lib/bffh/bffh.db"),
auditlog_path: PathBuf::from("/var/log/bffh/audit.log"), auditlog_path: PathBuf::from("/var/log/bffh/audit.json"),
roles: HashMap::new(), roles: HashMap::new(),
tlsconfig: TlsListen { tlsconfig: TlsListen {
certfile: PathBuf::from("./bffh.crt"), certfile: PathBuf::from("/etc/bffh/certs/bffh.crt"),
keyfile: PathBuf::from("./bffh.key"), keyfile: PathBuf::from("/etc/bffh/certs//bffh.key"),
..Default::default() ..Default::default()
}, },

View File

@ -23,12 +23,12 @@ fn main() -> miette::Result<()> {
build_kind=difluoroborane::env::BUILD_RUST_CHANNEL)) build_kind=difluoroborane::env::BUILD_RUST_CHANNEL))
.about(clap::crate_description!()) .about(clap::crate_description!())
.arg(Arg::new("config") .arg(Arg::new("config")
.help("Path to the config file to use") .help("Path to the DHALL config file to use")
.long("config") .long("config")
.short('c') .short('c')
.takes_value(true)) .takes_value(true))
.arg(Arg::new("verbosity") .arg(Arg::new("verbosity")
.help("Increase logging verbosity") .help("Increase logging verbosity. Stackable from -v up to -vvv")
.long("verbose") .long("verbose")
.short('v') .short('v')
.multiple_occurrences(true) .multiple_occurrences(true)
@ -47,18 +47,19 @@ fn main() -> miette::Result<()> {
.arg(Arg::new("log level") .arg(Arg::new("log level")
.help("Set the desired log levels.") .help("Set the desired log levels.")
.long("log-level") .long("log-level")
.takes_value(true)) .takes_value(true)
.possible_values(["info", "warn", "error", "debug", "trace"]))
.arg( .arg(
Arg::new("print default") Arg::new("print default")
.help("Print a default config to stdout instead of running") .help("Print a default DHALL config to stdout instead of running")
.long("print-default")) .long("print-default"))
.arg( .arg(
Arg::new("check config") Arg::new("check config")
.help("Check config for validity") .help("Check DHALL config for validity")
.long("check")) .long("check"))
.arg( .arg(
Arg::new("dump-db") Arg::new("dump-db")
.help("Dump all internal databases") .help("Dump all internal databases (states and users) to the given file as TOML")
.long("dump-db") .long("dump-db")
.alias("dump") .alias("dump")
.conflicts_with("dump-users") .conflicts_with("dump-users")
@ -83,29 +84,31 @@ fn main() -> miette::Result<()> {
) )
.arg( .arg(
Arg::new("force") Arg::new("force")
.help("force ops that may clobber") .help("Force owerwriting existing files")
.long("force") .long("force")
) )
.arg( .arg(
Arg::new("load-users") Arg::new("load-users")
.help("Load users into the internal databases") .help("Load users from TOML into the internal databases")
.long("load-users") .long("load-users")
.alias("load") .alias("load")
.takes_value(true) .takes_value(true)
.value_name("FILE")
.conflicts_with("dump-db") .conflicts_with("dump-db")
.conflicts_with("load-db") .conflicts_with("load-db")
.conflicts_with("dump-users") .conflicts_with("dump-users")
) )
.arg( .arg(
Arg::new("load-db") Arg::new("load-db")
.help("Load values into the internal databases") .help("Load values from TOML into the internal databases")
.long("load-db") .long("load-db")
.takes_value(true) .takes_value(true)
.value_name("FILE")
.conflicts_with("dump-db") .conflicts_with("dump-db")
.conflicts_with("load-users") .conflicts_with("load-users")
.conflicts_with("dump-users")) .conflicts_with("dump-users"))
.arg(Arg::new("keylog") .arg(Arg::new("keylog")
.help("log TLS keys into PATH. If no path is specified the value of the envvar SSLKEYLOGFILE is used.") .help("Log TLS keys into PATH. If no path is specified the value of the envvar SSLKEYLOGFILE is used.")
.long("tls-key-log") .long("tls-key-log")
.value_name("PATH") .value_name("PATH")
.takes_value(true) .takes_value(true)
@ -121,7 +124,7 @@ fn main() -> miette::Result<()> {
let configpath = matches let configpath = matches
.value_of("config") .value_of("config")
.unwrap_or("/etc/difluoroborane.dhall"); .unwrap_or("/etc/bffh/bffh.dhall");
// Check for the --print-default option first because we don't need to do anything else in that // Check for the --print-default option first because we don't need to do anything else in that
// case. // case.