diff options
author | Stephan Dilly <dilly.stephan@gmail.com> | 2021-03-14 00:25:30 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-14 00:25:30 +0100 |
commit | 7d4b79606c5d71ef7f2f9fa4ccd96c5a8a05dcf8 (patch) | |
tree | fe2377dfefe5e86f043624ae5cd6d69d78039347 /src/main.rs | |
parent | 52bf018515c5d8c3e84514f81bae5979441151b2 (diff) |
smarter config loading giving more diagnostics to the user about whats going wrong (#589)
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs index deaa4704..cfae967f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -43,6 +43,7 @@ use crossterm::{ ExecutableCommand, }; use input::{Input, InputEvent, InputState}; +use keys::KeyConfig; use profiler::Profiler; use scopeguard::defer; use scopetime::scope_time; @@ -61,6 +62,7 @@ use tui::{ backend::{Backend, CrosstermBackend}, Terminal, }; +use ui::style::Theme; static TICK_INTERVAL: Duration = Duration::from_secs(5); static SPINNER_INTERVAL: Duration = Duration::from_millis(80); @@ -88,6 +90,13 @@ fn main() -> Result<()> { return Ok(()); } + let key_config = KeyConfig::init(KeyConfig::get_config_file()?) + .map_err(|e| eprintln!("KeyConfig loading error: {}", e)) + .unwrap_or_default(); + let theme = Theme::init(cliargs.theme) + .map_err(|e| eprintln!("Theme loading error: {}", e)) + .unwrap_or_default(); + setup_terminal()?; defer! { shutdown_terminal().expect("shutdown failed"); @@ -105,7 +114,7 @@ fn main() -> Result<()> { let ticker = tick(TICK_INTERVAL); let spinner_ticker = tick(SPINNER_INTERVAL); - let mut app = App::new(&tx_git, input, cliargs.theme); + let mut app = App::new(&tx_git, input, theme, key_config); let mut spinner = Spinner::default(); let mut first_update = true; |