RegistryGenerator top-level property

FigGenerator RegistryGenerator
final

K3D 注册表生成器

Implementation

final FigGenerator RegistryGenerator = FigGenerator(
  script: ['k3d', 'registry', 'list', '--no-headers'],
  postProcess: (String out, [List<String>? tokens]) {
    return out
        .split('\n')
        .where((line) => line.trim().isNotEmpty)
        .map((line) {
          final parts = line.split(RegExp(r'\s+'));
          if (parts.length < 2) return null;

          final name = parts[0];
          final cluster = parts[1];

          return FigSuggestion(
            name: name,
            description: 'Registry $name of cluster $cluster',
            icon: '🏢', // 注册表图标
          );
        })
        .where((suggestion) => suggestion != null)
        .cast<FigSuggestion>()
        .toList();
  },
);