-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
29 lines (26 loc) · 844 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
const alfy = require('alfy');
const query = alfy.input;
const dataURL = `https://raw.githubusercontent.com/sasikanth513/alfred-meteor-packages/master/data.json`;
const atmoshphereURL = name => `https://atmospherejs.com/?q=${encodeURIComponent(name)}`
alfy.fetch(dataURL).then(data => {
const items = alfy
.inputMatches(data, 'name')
.map(item => ({
title: item.name,
subtitle: item.homepage ? item.homepage : atmoshphereURL(item.name),
arg: `meteor add ${item.name}`,
variables: {
action: 'clipboard'
},
mods: {
cmd: {
arg: item.homepage ? `${item.homepage}#readme` : atmoshphereURL(item.name),
subtitle: 'Open the package page in github',
variables: {
action: 'browser'
}
}
},
}));
alfy.output(items);
});