diff options
| author | Daniel Jankowski <daniel.jankowski@rub.de> | 2024-05-25 16:37:00 +0200 |
|---|---|---|
| committer | Daniel Jankowski <daniel.jankowski@rub.de> | 2024-05-25 16:37:00 +0200 |
| commit | 4c7d7a38804ea33e131dea5eabc0aca7477a642b (patch) | |
| tree | 7b87b0f7dd5da18d7d4618ad344993a90b3da8b8 /src/bin | |
| parent | feat: implement format precedence to hide overflown parts (diff) | |
| download | sl0pstatus-4c7d7a38804ea33e131dea5eabc0aca7477a642b.tar.gz sl0pstatus-4c7d7a38804ea33e131dea5eabc0aca7477a642b.tar.xz sl0pstatus-4c7d7a38804ea33e131dea5eabc0aca7477a642b.zip | |
feat: print config errors for users
Diffstat (limited to 'src/bin')
| -rw-r--r-- | src/bin/zjstatus.rs | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/bin/zjstatus.rs b/src/bin/zjstatus.rs index aac574c..388f9e8 100644 --- a/src/bin/zjstatus.rs +++ b/src/bin/zjstatus.rs @@ -27,6 +27,7 @@ struct State { userspace_configuration: BTreeMap<String, String>, module_config: config::ModuleConfig, widget_map: BTreeMap<String, Arc<dyn Widget>>, + err: Option<anyhow::Error>, } #[cfg(not(test))] @@ -73,7 +74,13 @@ impl ZellijPlugin for State { EventType::RunCommandResult, ]); - self.module_config = ModuleConfig::new(&configuration); + self.module_config = match ModuleConfig::new(&configuration) { + Ok(mc) => mc, + Err(e) => { + self.err = Some(e); + return; + } + }; self.widget_map = register_widgets(&configuration); self.userspace_configuration = configuration; self.pending_events = Vec::new(); @@ -147,6 +154,12 @@ impl ZellijPlugin for State { return; } + if let Some(err) = &self.err { + println!("Error: {:?}", err); + + return; + } + self.state.cols = cols; tracing::debug!("{:?}", self.state.mode.session_name); |
