Configuration does not store verbose/debugging flag information
This commit is contained in:
parent
6272bfd3a9
commit
77d2b189fb
2 changed files with 3 additions and 27 deletions
|
@ -17,8 +17,6 @@ use cli::CliConfig;
|
||||||
pub struct Configuration {
|
pub struct Configuration {
|
||||||
pub rtp : String,
|
pub rtp : String,
|
||||||
pub store_sub : String,
|
pub store_sub : String,
|
||||||
pub verbose : bool,
|
|
||||||
pub debugging : bool,
|
|
||||||
pub editor : Option<String>,
|
pub editor : Option<String>,
|
||||||
pub editor_opts : String,
|
pub editor_opts : String,
|
||||||
}
|
}
|
||||||
|
@ -31,23 +29,17 @@ impl Configuration {
|
||||||
|
|
||||||
let cfg = fetch_config(&rtp);
|
let cfg = fetch_config(&rtp);
|
||||||
|
|
||||||
let verbose = cfg.lookup_boolean("verbose").unwrap_or(false);
|
|
||||||
let debugging = cfg.lookup_boolean("debug").unwrap_or(false);
|
|
||||||
let store_sub = String::from(cfg.lookup_str("store").unwrap_or("/store"));
|
let store_sub = String::from(cfg.lookup_str("store").unwrap_or("/store"));
|
||||||
let editor = cfg.lookup_str("editor").map(String::from);
|
let editor = cfg.lookup_str("editor").map(String::from);
|
||||||
let editor_opts = String::from(cfg.lookup_str("editor-opts").unwrap_or(""));
|
let editor_opts = String::from(cfg.lookup_str("editor-opts").unwrap_or(""));
|
||||||
|
|
||||||
debug!("Building configuration");
|
debug!("Building configuration");
|
||||||
debug!(" - verbose : {}", verbose);
|
|
||||||
debug!(" - debugging : {}", debugging);
|
|
||||||
debug!(" - store sub : {}", store_sub);
|
debug!(" - store sub : {}", store_sub);
|
||||||
debug!(" - runtimepath: {}", rtp);
|
debug!(" - runtimepath: {}", rtp);
|
||||||
debug!(" - editor : {:?}", editor);
|
debug!(" - editor : {:?}", editor);
|
||||||
debug!(" - editor-opts: {}", editor_opts);
|
debug!(" - editor-opts: {}", editor_opts);
|
||||||
|
|
||||||
Configuration {
|
Configuration {
|
||||||
verbose: verbose,
|
|
||||||
debugging: debugging,
|
|
||||||
store_sub: store_sub,
|
store_sub: store_sub,
|
||||||
rtp: rtp,
|
rtp: rtp,
|
||||||
editor: editor,
|
editor: editor,
|
||||||
|
@ -55,20 +47,6 @@ impl Configuration {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Check whether the configuration says we should run verbose
|
|
||||||
*/
|
|
||||||
pub fn is_verbose(&self) -> bool {
|
|
||||||
self.verbose
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check whether the configuration says we should run in debugging
|
|
||||||
*/
|
|
||||||
pub fn is_debugging(&self) -> bool {
|
|
||||||
self.debugging
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the store path the configuration configured
|
* Get the store path the configuration configured
|
||||||
*/
|
*/
|
||||||
|
@ -128,9 +106,7 @@ fn default_path() -> Option<String> {
|
||||||
impl Debug for Configuration {
|
impl Debug for Configuration {
|
||||||
|
|
||||||
fn fmt(&self, f: &mut Formatter) -> Result<(), Error> {
|
fn fmt(&self, f: &mut Formatter) -> Result<(), Error> {
|
||||||
write!(f, "Configuration (verbose: {}, debugging: {}, rtp: {}, store path: {})",
|
write!(f, "Configuration (rtp: {}, store path: {})",
|
||||||
self.is_verbose(),
|
|
||||||
self.is_debugging(),
|
|
||||||
self.get_rtp(),
|
self.get_rtp(),
|
||||||
self.store_path()
|
self.store_path()
|
||||||
)
|
)
|
||||||
|
|
|
@ -77,14 +77,14 @@ impl<'a> Runtime<'a> {
|
||||||
* Check whether we run verbose
|
* Check whether we run verbose
|
||||||
*/
|
*/
|
||||||
pub fn is_verbose(&self) -> bool {
|
pub fn is_verbose(&self) -> bool {
|
||||||
self.config.is_verbose() || self.configuration.is_verbose()
|
self.config.is_verbose()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check whether we run in debugging
|
* Check whether we run in debugging
|
||||||
*/
|
*/
|
||||||
pub fn is_debugging(&self) -> bool {
|
pub fn is_debugging(&self) -> bool {
|
||||||
self.config.is_debugging() || self.configuration.is_verbose()
|
self.config.is_debugging()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue