gayconf/src/main.rs
2021-04-26 18:38:44 +02:00

34 lines
969 B
Rust

// See the end of this file for copyright and license terms.
use std::env;
use std::fs;
use gayconf::Config;
fn main() {
let argv: Vec<String> = env::args().collect();
if argv.len() != 2 {
panic!("Usage: {} <file>", &argv[0]);
}
let s = fs::read_to_string(&argv[1]).expect("Cannot open file");
match Config::parse(s.chars()) {
Ok(conf) => {
for k in conf.keys() {
println!("{:?}", conf.get_node(k));
}
}
Err(e) => panic!("{:?}", e.msg),
}
}
// Copyright (C) 2021 Fefie <owo@fef.moe>
// This file is part of gayconf.
//
// gayconf is non-violent software: you can use, redistribute,
// and/or modify it under the terms of the CNPLv6+ as found
// in the LICENSE file in the source code root directory or
// at <https://git.pixie.town/thufie/CNPL>.
//
// gayconf comes with ABSOLUTELY NO WARRANTY, to the extent
// permitted by applicable law. See the CNPL for details.