extractCommentLabel function

String? extractCommentLabel(
  1. String command
)

Extract comment label from first line of command.

Implementation

String? extractCommentLabel(String command) {
  final firstLine = command.split('\n').first.trim();
  final match = RegExp(r'^#\s*(.+)$').firstMatch(firstLine);
  return match?.group(1)?.trim();
}