parseSegmentOptions function

StatusLineSegmentOptions parseSegmentOptions(
  1. Object? node
)

Parses the segmentOptions: node into the explicit-override shape (only the fields the user mentioned are non-null).

Implementation

StatusLineSegmentOptions parseSegmentOptions(Object? node) {
  final map = node as YamlMap;
  _checkStrictKeys(map, 'tui.statusLine.segmentOptions', const {
    'model',
    'path',
    'git',
    'time',
  });
  final model = _subSection(map, 'model');
  final path = _subSection(map, 'path');
  final git = _subSection(map, 'git');
  final time = _subSection(map, 'time');
  return StatusLineSegmentOptions(
    modelShowThinkingLevel: _boolOpt(model, 'showThinkingLevel'),
    pathAbbreviate: _boolOpt(path, 'abbreviate'),
    pathMaxLength: _positiveInt(path, 'maxLength'),
    pathStripWorkPrefix: _boolOpt(path, 'stripWorkPrefix'),
    gitShowBranch: _boolOpt(git, 'showBranch'),
    gitShowStaged: _boolOpt(git, 'showStaged'),
    gitShowUnstaged: _boolOpt(git, 'showUnstaged'),
    gitShowUntracked: _boolOpt(git, 'showUntracked'),
    time24h: _time24h(time),
    timeShowSeconds: _boolOpt(time, 'showSeconds'),
  );
}