parse static method
Implementation
static EditPlan parse(String command, {EditTemplate? template}) {
final text = _normalise(command);
final plan = EditPlan();
final chosen = template ?? _templateFrom(text);
if (chosen != null) _applyTemplate(plan, chosen);
for (final clause in _clauses(text)) {
_applyClause(plan, clause, command);
}
// Emoji typed straight into the request become stickers.
for (final match in _emoji.allMatches(command)) {
if (!plan.stickers.contains(match.group(0))) plan.stickers.add(match.group(0)!);
}
plan.targetLength = _lengthFrom(text) ?? plan.targetLength;
if (_wantsHighlights.hasMatch(text)) {
// "a 30 second short of the best parts": the length is for the short.
plan.highlightLength = plan.targetLength ?? const Duration(seconds: 30);
plan.targetLength = null;
}
plan.hookText = _quoted(command) ?? plan.hookText;
return plan;
}