mirror of
https://gitlab.com/fabinfra/fabaccess/bffh.git
synced 2025-03-13 00:21:51 +01:00
cleanup --help
This commit is contained in:
parent
40f3747eb6
commit
e85770ea54
@ -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)
|
||||||
@ -119,9 +122,7 @@ fn main() -> miette::Result<()> {
|
|||||||
Err(error) => error.exit(),
|
Err(error) => error.exit(),
|
||||||
};
|
};
|
||||||
|
|
||||||
let configpath = matches
|
let configpath = matches.value_of("config").unwrap_or("/etc/bffh/bffh.dhall");
|
||||||
.value_of("config")
|
|
||||||
.unwrap_or("/etc/difluoroborane.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.
|
||||||
@ -130,7 +131,7 @@ fn main() -> miette::Result<()> {
|
|||||||
let encoded = serde_dhall::serialize(&config).to_string().unwrap();
|
let encoded = serde_dhall::serialize(&config).to_string().unwrap();
|
||||||
|
|
||||||
// Direct writing to fd 1 is faster but also prevents any print-formatting that could
|
// Direct writing to fd 1 is faster but also prevents any print-formatting that could
|
||||||
// invalidate the generated TOML
|
// invalidate the generated DHALL
|
||||||
let stdout = io::stdout();
|
let stdout = io::stdout();
|
||||||
let mut handle = stdout.lock();
|
let mut handle = stdout.lock();
|
||||||
handle.write_all(encoded.as_bytes()).unwrap();
|
handle.write_all(encoded.as_bytes()).unwrap();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user