parseShellFrontmatter function
Parse and validate the shell: frontmatter field.
Implementation
FrontmatterShell? parseShellFrontmatter(
dynamic value, {
required String source,
}) {
if (value == null) return null;
final normalized = '$value'.trim().toLowerCase();
if (normalized.isEmpty) return null;
switch (normalized) {
case 'bash':
return FrontmatterShell.bash;
case 'powershell':
return FrontmatterShell.powershell;
default:
stderr.writeln(
"Frontmatter 'shell: $value' in $source is not recognized. "
'Valid values: bash, powershell. Falling back to bash.',
);
return null;
}
}