programGenerator top-level property

FigGenerator programGenerator
final

Implementation

final FigGenerator programGenerator = FigGenerator(
  script: [
    'bash',
    '-c',
    'for i in \$(echo \$PATH | tr ":" "\\n"); do find \$i -maxdepth 1 -perm -111 -type f; done',
  ],
  postProcess: (String out, [List<String>? tokens]) {
    return out
        .split('\n')
        .where((path) => path.isNotEmpty)
        .map((path) => path.split('/').last)
        .map((pr) => FigSuggestion(
              name: pr,
              description: 'Executable file',
            ))
        .toList();
  },
);