zola/components/config/src/lib.rs

33 lines
691 B
Rust
Raw Normal View History

2017-07-01 07:47:41 +00:00
#[macro_use]
extern crate serde_derive;
extern crate chrono;
extern crate globset;
2019-01-11 19:29:46 +00:00
extern crate toml;
2018-10-09 12:33:43 +00:00
#[macro_use]
extern crate lazy_static;
extern crate syntect;
2016-12-06 05:51:33 +00:00
2019-01-11 19:29:46 +00:00
#[macro_use]
extern crate errors;
extern crate utils;
2018-10-09 12:33:43 +00:00
mod config;
pub mod highlighting;
2018-10-31 07:18:57 +00:00
mod theme;
2018-12-29 10:17:43 +00:00
pub use config::{Config, Language, Taxonomy};
2018-10-09 12:33:43 +00:00
use std::path::Path;
2017-03-06 14:45:57 +00:00
/// 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);
}
}
}