parseTuiSection function
Parses the tui: yaml section. Strict (the repo's ConfigException
conventions): a non-map node, a bad scalar or an unknown key throws —
a typo must never silently skip a section. Absent section → defaults.
Implementation
TuiSectionConfig parseTuiSection(Object? node) {
if (node == null) return const TuiSectionConfig();
if (node is! YamlMap) {
throw ConfigException('tui must be a map, got: $node');
}
_checkStrictKeys(node, 'tui', const {
'theme',
'classic',
'showCompactionDetails',
'statusLine',
});
final theme = _tuiThemeName(node['theme']);
final classic = _tuiBoolFlag('tui.classic', node['classic']);
final showCompactionDetails = _tuiBoolFlag(
'tui.showCompactionDetails',
node['showCompactionDetails'],
);
final statusLine = node['statusLine'];
if (statusLine != null && statusLine is! YamlMap) {
throw ConfigException('"tui.statusLine" must be a map, got: $statusLine');
}
return TuiSectionConfig(
theme: theme,
classic: classic,
showCompactionDetails: showCompactionDetails,
statusLine: statusLine == null ? null : parseStatusLineConfig(statusLine),
);
}