mirror of
https://github.com/withfig/autocomplete.git
synced 2025-12-18 12:02:02 +01:00
33 lines
1000 B
TypeScript
33 lines
1000 B
TypeScript
// 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
|
|
);
|
|
});
|
|
},
|
|
},
|
|
},
|
|
};
|
|
},
|
|
};
|