zola/components/config/src/lib.rs
2018-10-09 14:33:43 +02:00

32 lines
661 B
Rust

#[macro_use]
extern crate serde_derive;
extern crate toml;
#[macro_use]
extern crate errors;
extern crate chrono;
extern crate globset;
#[macro_use]
extern crate lazy_static;
extern crate syntect;
mod config;
mod theme;
pub mod highlighting;
pub use config::{Config, Taxonomy};
use std::path::Path;
/// Get and parse the config.
/// If it doesn't succeed, exit
pub fn get_config(path: &Path, filename: &str) -> Config {
match Config::from_file(path.join(filename)) {
Ok(c) => c,
Err(e) => {
println!("Failed to load {}", filename);
println!("Error: {}", e);
::std::process::exit(1);
}
}
}