diff options
author | Jan Hrastnik | 2021-06-19 12:51:53 +0000 |
---|---|---|
committer | Jan Hrastnik | 2021-06-19 12:51:53 +0000 |
commit | cdd9347457f0608346894cd0aab35b412cb59a7b (patch) | |
tree | 468078c37311cb1c7f9e7d4bd8a03c493d25e669 /helix-term/src/main.rs | |
parent | 97323dc2f90f81afc82bd929d111abda540bebe5 (diff) | |
parent | 2cbec2b0470d0759578929b224c445b69617b6b6 (diff) |
Merge remote-tracking branch 'origin/master' into line_ending_detection
Diffstat (limited to 'helix-term/src/main.rs')
-rw-r--r-- | helix-term/src/main.rs | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/helix-term/src/main.rs b/helix-term/src/main.rs index 9d4e1c5b..12176910 100644 --- a/helix-term/src/main.rs +++ b/helix-term/src/main.rs @@ -1,10 +1,9 @@ +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(); @@ -89,10 +88,16 @@ 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)), + }; + setup_logging(logpath, args.verbosity).context("failed to initialize logging")?; // TODO: use the thread local executor to spawn the application task separately from the work pool - let mut app = Application::new(args).context("unable to create new appliction")?; + let mut app = Application::new(args, config).context("unable to create new application")?; app.run().await.unwrap(); Ok(()) |