parseInlineCommand static method

List<String> parseInlineCommand(
  1. String fullCommand
)

Implementation

static List<String> parseInlineCommand(String fullCommand) {
  fullCommand = fullCommand.trim();

  var list = <String>[];

  fullCommand.splitMapJoin(
    RegExp(r'(\s+)|"(.*?)"'),
    onMatch: (m) {
      var quoted = m[2];
      if (quoted != null) {
        list.add(quoted);
      }
      return '';
    },
    onNonMatch: (s) {
      if (s.isNotEmpty) {
        list.add(s);
      }
      return '';
    },
  );

  return list;
}