forked from kbshl/alfred-vscode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
39 lines (31 loc) · 805 Bytes
/
index.js
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
35
36
37
38
39
const alfy = require('alfy');
const utils = require('./lib/utils');
(async () => {
const file = utils.getProjectFilePath();
const projects = await utils.fetch(file, {
transform: utils.parseProjects,
});
const matchedProjects = utils.inputMatchesData(
projects,
alfy.input,
['name', 'group'],
)
.sort((a, b) => a.name.localeCompare(b.name))
.map(project => ({
title: utils.getTitle(project),
subtitle: utils.getSubtitle(project),
icon: utils.getIcon(project),
arg: utils.getArgument(project),
valid: true,
text: {
copy: utils.getArgument(project),
},
}));
if (matchedProjects.length === 0) {
alfy.output([{
title: 'No projects found',
}]);
return;
}
alfy.output(matchedProjects);
})();