ClusterGenerator top-level property
K3D 集群生成器
Implementation
final FigGenerator ClusterGenerator = FigGenerator(
script: ['k3d', 'cluster', '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 < 3) return null;
final name = parts[0];
final servers = parts[1];
final agents = parts[2];
return FigSuggestion(
name: name,
icon: 'fig://icon?type=kubernetes',
description: 'Cluster with $servers server(s), $agents agent(s)',
);
})
.where((suggestion) => suggestion != null)
.cast<FigSuggestion>()
.toList();
},
);