forked from withfig/autocomplete
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bunx.ts
34 lines (32 loc) · 811 Bytes
/
bunx.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { npxSuggestions } from "./npx";
const bunx: Fig.Spec = {
name: "bunx",
args: {
name: "command",
isCommand: true,
generators: {
script: [
"bash",
"-c",
"until [[ -d node_modules/ ]] || [[ $PWD = '/' ]]; do cd ..; done; ls -1 node_modules/.bin/`",
],
postProcess: function (out) {
const cli = [...npxSuggestions].reduce(
(acc, { name }) => [...acc, name],
[]
);
return out
.split("\n")
.filter((name) => !cli.includes(name))
.map((name) => ({
name,
icon: "fig://icon?type=command",
loadSpec: name,
}));
},
},
description: "The command to run",
suggestions: [...npxSuggestions],
},
};
export default bunx;