variablesGenerator top-level property
Implementation
final FigGenerator variablesGenerator = FigGenerator(
trigger: ':',
script: (List<String> tokens) {
if (tokens.isEmpty || !tokens.last.contains(':')) return [];
return [
"bash",
"-c",
'for i in \$(find -E . -regex ".*.(robot|resource)" -type f); do cat -s \$i ; done',
];
},
postProcess: (String out, [List<String>? tokens]) {
final iter = RegExp(r'^\$\{(.*?)\}', multiLine: true).allMatches(out);
return iter
.map((m) => m.group(1))
.whereType<String>()
.map((variable) => FigSuggestion(
name: variable,
description: "Variable",
))
.toList();
},
);