diff --git a/src/cli.rs b/src/cli.rs index 7d148456..27ac1f3b 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -33,5 +33,9 @@ impl<'a> CliConfig<'a> { pub fn is_debugging(&self) -> bool { self.cli_matches.is_present("debug") } + + pub fn get_rtp(&self) -> Option { + self.cli_matches.value_of("rtp").and_then(|s| Some(String::from(s))) + } } diff --git a/src/configuration.rs b/src/configuration.rs index d6d6643b..6ee3d2d2 100644 --- a/src/configuration.rs +++ b/src/configuration.rs @@ -57,6 +57,10 @@ impl Configuration { format!("{}{}", self.rtp, self.store_sub) } + pub fn get_rtp(&self) -> String { + self.rtp.clone() + } + } fn rtp_path(config: &CliConfig) -> String { diff --git a/src/runtime.rs b/src/runtime.rs index 4784e7dd..45c0a7d1 100644 --- a/src/runtime.rs +++ b/src/runtime.rs @@ -72,4 +72,12 @@ impl<'a> Runtime<'a> { self.config.is_debugging() || self.configuration.is_verbose() } + pub fn get_rtp(&self) -> String { + if let Some(rtp) = self.config.get_rtp() { + rtp + } else { + self.configuration.get_rtp() + } + } + }