buildValidationContext function
Build a ValidationContext from a command string.
Implementation
ValidationContext buildValidationContext(String command) {
final trimmed = command.trim();
final baseCommand = trimmed.split(RegExp(r'\s'))[0];
final extracted = extractQuotedContent(command);
final fullyUnquotedPreStrip = extracted.fullyUnquoted;
final fullyUnquotedContent = stripSafeRedirections(extracted.fullyUnquoted);
final unquotedContent = extracted.withDoubleQuotes;
return ValidationContext(
originalCommand: command,
baseCommand: baseCommand,
unquotedContent: unquotedContent,
fullyUnquotedContent: fullyUnquotedContent,
fullyUnquotedPreStrip: fullyUnquotedPreStrip,
unquotedKeepQuoteChars: extracted.unquotedKeepQuoteChars,
);
}