name property

String get name

return parameter name

example run get create page:product on home

print(name); // product

Implementation

String get name {
  var args = List.of(_args);
  _removeDefaultArgs(args);
  if (args.length > 1) {
    if (args[0] == 'create' || args[0] == '-c') {
      var arg = args[1];
      var split = arg.split(':');
      var type = split.first;
      var name = split.last;

      if (name == type) {
        if (args.length > 2) {
          name = args[2];
        } else {
          name = '';
        }
      }
      if (type == 'project') {
        return name.isEmpty ? '.' : name.snakeCase;
      }
      return name;
    }
  }
  return '';
}