recordCommand method

void recordCommand(
  1. String explanation, {
  2. bool error = false,
})

Implementation

void recordCommand(String explanation, {bool error = false}) {
  final start = _parser.tokenBegin;
  final end = _parser.tokenEnd;

  if (commands.isNotEmpty && commands.last.end == end) {
    commands.last.explanation.add(explanation);
  } else {
    final charCodes = recorded.sublist(start, end);
    final chars = String.fromCharCodes(charCodes);
    final escapedChars = _escape(chars);
    commands.add(
      TerminalCommand(start, end, chars, escapedChars, [explanation], error),
    );
  }
}