mirror of
https://gitlab.com/fabinfra/fabaccess/bffh.git
synced 2024-11-26 00:24:55 +01:00
only do a basic config check
Printing of normalized dhall will have to wait until i figure out how to supply the needed type info to the serializer
This commit is contained in:
parent
4349a6fee6
commit
8d337248a8
10
src/main.rs
10
src/main.rs
@ -63,7 +63,6 @@ fn main() {
|
|||||||
.arg(Arg::with_name("check config")
|
.arg(Arg::with_name("check config")
|
||||||
.help("Check config for validity")
|
.help("Check config for validity")
|
||||||
.long("check")
|
.long("check")
|
||||||
.requires("config")
|
|
||||||
)
|
)
|
||||||
.arg(Arg::with_name("dump")
|
.arg(Arg::with_name("dump")
|
||||||
.help("Dump all databases into the given directory")
|
.help("Dump all databases into the given directory")
|
||||||
@ -97,13 +96,8 @@ fn main() {
|
|||||||
let configpath = matches.value_of("config").unwrap_or("/etc/diflouroborane.dhall");
|
let configpath = matches.value_of("config").unwrap_or("/etc/diflouroborane.dhall");
|
||||||
match config::read(&PathBuf::from_str(configpath).unwrap()) {
|
match config::read(&PathBuf::from_str(configpath).unwrap()) {
|
||||||
Ok(cfg) => {
|
Ok(cfg) => {
|
||||||
let encoded = serde_dhall::serialize(&cfg).to_string().unwrap();
|
//TODO: print a normalized version of the supplied config
|
||||||
|
println!("config is valid");
|
||||||
// Direct writing to fd 1 is faster but also prevents any print-formatting that could
|
|
||||||
// invalidate the generated TOML
|
|
||||||
let stdout = io::stdout();
|
|
||||||
let mut handle = stdout.lock();
|
|
||||||
handle.write_all(&encoded.as_bytes()).unwrap();
|
|
||||||
std::process::exit(0);
|
std::process::exit(0);
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user