-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathls.js
31 lines (28 loc) · 786 Bytes
/
ls.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
'use strict';
const alfy = require('alfy');
const dateFormat = require('date-format');
const nowUrl = 'https://api.zeit.co/v2/now/';
const Authorization = 'Bearer ' + process.env.token;
alfy.fetch(nowUrl + 'deployments', {
headers: {
Authorization
}
}).then(data => {
const deployments = alfy
.inputMatches(data.deployments, 'name')
.filter(deployment => deployment.state === 'READY')
.map(deployment => ({
uid: deployment.uid,
title: deployment.name,
subtitle: deployment.url,
arg: 'https://' + deployment.url,
autocomplete: deployment.name,
quicklookurl: deployment.url,
mods: {
cmd: {
subtitle: `Type ${deployment.type}, created at ${dateFormat('yyyy-dd-MM', new Date(deployment.created))}`
}
}
}))
alfy.output(deployments);
});