diff options
author | Blaž Hrastnik | 2021-06-19 14:59:19 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2021-06-19 14:59:19 +0000 |
commit | 10f9f72232f5789323d689bf0f9cd359715770d6 (patch) | |
tree | dbf4f6ab6221b7522445fa765079ee61f47294bb /helix-term/src/main.rs | |
parent | 11f20af25fa7335f3f49c0e33d6a2790d60c9647 (diff) |
Revert "Refactor key into helix-view"
Did not use defaults when custom keymap was used
This reverts commit ca806d4f852e934651132fc9570a6110e30f646d.
Diffstat (limited to 'helix-term/src/main.rs')
-rw-r--r-- | helix-term/src/main.rs | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/helix-term/src/main.rs b/helix-term/src/main.rs index 12176910..ef912480 100644 --- a/helix-term/src/main.rs +++ b/helix-term/src/main.rs @@ -1,9 +1,10 @@ -use anyhow::{Context, Error, Result}; use helix_term::application::Application; use helix_term::args::Args; use helix_term::config::Config; use std::path::PathBuf; +use anyhow::{Context, Result}; + fn setup_logging(logpath: PathBuf, verbosity: u64) -> Result<()> { let mut base_config = fern::Dispatch::new(); @@ -88,11 +89,12 @@ FLAGS: std::fs::create_dir_all(&conf_dir).ok(); } - let config = match std::fs::read_to_string(conf_dir.join("config.toml")) { - Ok(config) => toml::from_str(&config)?, - Err(err) if err.kind() == std::io::ErrorKind::NotFound => Config::default(), - Err(err) => return Err(Error::new(err)), - }; + let config = std::fs::read_to_string(conf_dir.join("config.toml")) + .ok() + .map(|s| toml::from_str(&s)) + .transpose()? + .or_else(|| Some(Config::default())) + .unwrap(); setup_logging(logpath, args.verbosity).context("failed to initialize logging")?; |