forked from withfig/autocomplete
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathphp.ts
32 lines (29 loc) · 1000 Bytes
/
php.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
// To learn more about Fig's autocomplete standard visit: https://fig.io/docs/autocomplete/building-a-spec#building-your-first-autocomplete-spec
// The below is a dummy example for git. Make sure to change the file name!
export const completion: Fig.Spec = {
name: "php",
description: "Run the PHP interpreter",
generateSpec: async (context, executeShellCommand) => {
const subcommands = [];
if ((await executeShellCommand("ls -1 artisan")) === "artisan") {
subcommands.push({ name: "artisan", loadSpec: "php/artisan" });
}
return {
name: "php",
subcommands,
args: {
generators: {
template: "filepaths",
filterTemplateSuggestions: function (suggestions) {
return suggestions.filter((suggestion) => {
return (
// suggestion.name.endsWith(".php") ||
suggestion.name.indexOf(".") === -1
);
});
},
},
},
};
},
};