makeTasksGenerator top-level property
Implementation
final FigGenerator makeTasksGenerator = FigGenerator(
custom: (tokens, executeCommand, context) async {
if (executeCommand == null) return [];
String makefileLocation = 'Makefile.toml';
final makefileFlagIdx = tokens.indexWhere((param) => param == '--makefile');
if (makefileFlagIdx != -1 && tokens.length > makefileFlagIdx + 1) {
makefileLocation = tokens[makefileFlagIdx + 1];
}
final output = await executeCommand(ExecuteCommandInput(
command: 'cat',
args: [makefileLocation],
));
final taskRegex = RegExp(r'\[tasks\.([^\]]+)\]');
final matches = taskRegex.allMatches(output.stdout);
return matches
.map((match) => FigSuggestion(
name: match.group(1),
))
.toList();
},
);