membersGenerators top-level property
Implementation
final membersGenerators = FigGenerator(
cache: FigCache(
strategy: "stale-while-revalidate",
ttl: 1000 * 60,
),
custom: (List<String> tokens, ExecuteCommandFunction? executeShellCommand,
FigGeneratorContext? context) async {
if (executeShellCommand == null) return [];
// tokens.at(-3) in TS. In Dart:
if (tokens.length < 3) return [];
final teamName = tokens[tokens.length - 3];
final out = await executeShellCommand(ExecuteCommandInput(
command: "fig",
args: ["team", "--format", "json", teamName, "members"],
));
final json = jsonDecode(out.stdout) as List;
return json
.map((member) => FigSuggestion(
name: member['email'],
description: "Role: ${member['role']}",
))
.toList();
},
);