bunxSpec top-level property

FigSpec bunxSpec
final

Implementation

final FigSpec bunxSpec = FigSpec(
  name: 'bunx',
  description: 'The command to run',
  args: [
    FigArg(
      name: 'command',
      isCommand: true,
      generators: [
        FigGenerator(
          script: [
            'bash',
            '-c',
            'until [[ -d node_modules/ ]] || [[ \$PWD = \'/\' ]]; do cd ..; done; ls -1 node_modules/.bin/',
          ],
          postProcess: (String out, [List<String>? tokens]) {
            final cli = _npxSuggestions.map((e) => e.name!).toSet();
            return out
                .split('\n')
                .where((name) => name.isNotEmpty && !cli.contains(name))
                .map((name) => FigSuggestion(
                      name: name,
                      icon: 'fig://icon?type=command',
                      loadSpec: name,
                    ))
                .toList();
          },
        )
      ],
      suggestions: _npxSuggestions,
    ),
  ],
);