-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
34 lines (31 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
30
31
32
33
const alfy = require('alfy');
const got = require('got');
const input = alfy.input.toLowerCase();
const fileUrl = 'https://github.com/krschultz/android-proguard-snippets/blob/master/';
function filter(tree) {
return tree
.filter(x => {
return x.path.indexOf('libraries') >= 0;
})
.filter(x => {
filename = x.path.replace(/libraries\//, '')
return filename.endsWith('.pro') &&
filename.toLowerCase().indexOf(input) >= 0
})
.map(x => {
filename = x.path.replace(/libraries\//, '')
return {
title: filename,
arg: fileUrl + x.path
}
})
.sort();
}
const url = 'https://alfred-workflows-62254.firebaseio.com/pg.json'
alfy.fetch(url, {
maxAge: 86400000, // 24 hours
})
.then(items => {
const output = filter(items);
alfy.output(output);
})