diff options
author | Jesse Luehrs <doy@tozt.net> | 2019-10-18 12:47:09 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2019-10-18 12:59:35 -0400 |
commit | e5ccc1d13a82ec9b3bf86e61c045107b3171dfb2 (patch) | |
tree | 599866debbbfa453a3abce2df4d3278daa7e535e /src/cmd/play.rs | |
parent | a561217eca9f3076b097e6af3ee6cf229cf35668 (diff) | |
download | teleterm-e5ccc1d13a82ec9b3bf86e61c045107b3171dfb2.tar.gz teleterm-e5ccc1d13a82ec9b3bf86e61c045107b3171dfb2.zip |
load config data from a file too
Diffstat (limited to 'src/cmd/play.rs')
-rw-r--r-- | src/cmd/play.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/cmd/play.rs b/src/cmd/play.rs index a5fd534..bc8a214 100644 --- a/src/cmd/play.rs +++ b/src/cmd/play.rs @@ -43,8 +43,11 @@ pub fn cmd<'a, 'b>(app: clap::App<'a, 'b>) -> clap::App<'a, 'b> { ) } -pub fn config() -> Box<dyn crate::config::Config> { - Box::new(Config::default()) +pub fn config(config: config::Config) -> Box<dyn crate::config::Config> { + Box::new(config.try_into().unwrap_or_else(|e| { + log::warn!("failed to parse config data: {}", e); + Config::default() + })) } #[allow(clippy::large_enum_variant)] |