1use crate::types::AutoHandoffConfig;
6
7pub fn parse_auto_handoff_config(config_toml: &str) -> AutoHandoffConfig {
12 let mut config = AutoHandoffConfig::default();
13
14 if let Ok(table) = config_toml.parse::<toml::Value>() {
15 if let Some(tui) = table.get("tui").and_then(|v| v.as_table()) {
16 if let Some(ah) = tui.get("auto_handoff").and_then(|v| v.as_table()) {
17 if let Some(enabled) = ah.get("enabled").and_then(|v| v.as_bool()) {
18 config.enabled = enabled;
19 }
20 if let Some(threshold) = ah.get("context_threshold").and_then(|v| v.as_integer()) {
21 config.context_threshold = threshold as usize;
22 }
23 }
24 }
25 }
26
27 config
28}