namespaces top-level property
Implementation
final FigGenerator namespaces = FigGenerator(
script: ['envchain', '--list'],
postProcess: (String output, [List<String>? tokens]) {
try {
// 分割、去重、过滤、排序
final namespaceList = output
.split('\n')
.map((line) => line.trim())
.where((line) => line.isNotEmpty)
.toSet() // 去重
.toList()
..sort(); // 排序
return namespaceList
.map((namespace) => FigSuggestion(
name: namespace,
description: 'NAMESPACE $namespace',
icon: '🔐', // 添加图标表示环境变量
priority: 50,
))
.toList();
} catch (e) {
print('Error processing namespaces: $e');
return <FigSuggestion>[];
}
},
);