Add configuration file parsing for reporting mode

This commit is contained in:
Matthias Beyer 2016-01-06 19:25:01 +01:00
parent aa30137300
commit d9deb9025b

View file

@ -19,6 +19,7 @@ pub struct Configuration {
pub store_sub : String,
pub editor : Option<String>,
pub editor_opts : String,
pub report_exit : bool,
}
impl Configuration {
@ -32,18 +33,21 @@ impl Configuration {
let store_sub = String::from(cfg.lookup_str("store").unwrap_or("/store"));
let editor = cfg.lookup_str("editor").map(String::from);
let editor_opts = String::from(cfg.lookup_str("editor-opts").unwrap_or(""));
let report_exit = cfg.lookup_boolean("report-exit").unwrap_or(false);
debug!("Building configuration");
debug!(" - store sub : {}", store_sub);
debug!(" - runtimepath: {}", rtp);
debug!(" - editor : {:?}", editor);
debug!(" - editor-opts: {}", editor_opts);
debug!(" - report exit: {}", report_exit);
Configuration {
store_sub: store_sub,
rtp: rtp,
editor: editor,
editor_opts: editor_opts,
report_exit: report_exit,
}
}
@ -69,6 +73,10 @@ impl Configuration {
self.editor_opts.clone()
}
pub fn report_exit(&self) -> bool {
self.report_exit
}
}
/**