configList top-level property
Implementation
final FigGenerator configList = FigGenerator(
script: ['yarn', 'config', 'list'],
postProcess: (String out, [List<String>? tokens]) {
if (out.trim().isEmpty) {
return <FigSuggestion>[];
}
try {
final startIndex = out.indexOf('{');
final endIndex = out.indexOf('}');
if (startIndex == -1 || endIndex == -1) {
return <FigSuggestion>[];
}
String output = out.substring(startIndex, endIndex + 1);
output = output
.replaceAll("'", '"')
.replaceAll('lastUpdateCheck', '"lastUpdateCheck"')
.replaceAll('registry', '"registry"');
final configObject = jsonDecode(output) as Map<String, dynamic>;
return configObject.keys
.map((key) => FigSuggestion(
name: key,
))
.toList();
} catch (e) {
print('Error in configList: $e');
return <FigSuggestion>[];
}
},
);