sshHostsGenerator top-level property

FigGenerator sshHostsGenerator
final

Implementation

final sshHostsGenerator = FigGenerator(
  script: [
    "fig",
    "_",
    "request",
    "--method",
    "GET",
    "--route",
    "/access/hosts/all",
  ],
  cache: FigCache(strategy: "stale-while-revalidate"),
  postProcess: (String out, [List<String>? tokens]) {
    final json = jsonDecode(out) as List;
    return json
        .map((host) => FigSuggestion(
              insertValue: "@${host['namespace']}/${host['nickName']}",
              displayName: "${host['nickName']} (@${host['namespace']})",
              name: "@${host['namespace']}/${host['nickName']}",
              description: host['description'],
            ))
        .toList();
  },
);