-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
24 lines (23 loc) · 876 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
const alfy = require('alfy');
const encodeurl = require('encodeurl');
const url = `https://vimawesome.com/api/plugins?query=${encodeurl(alfy.input)}`;
alfy.fetch(url).then(data => {
const items = data.plugins.map(plugin => {
const author = plugin.github_author || plugin.author;
let desc = plugin.github_short_desc || plugin.short_desc;
if (desc.length > 50) desc = `${desc.substring(0, 50).trim()}...`;
return {
title: `${plugin.name} 👤 ${author}`,
subtitle: `${desc} || ${plugin.category} 👥 ${plugin.plugin_manager_users} || ⭐ ${plugin.github_stars}`,
arg: plugin.github_url,
mods: {
ctrl: {
valid: true,
arg: `${plugin.github_owner}/${plugin.github_repo_name}`,
subtitle: `${plugin.github_owner}/${plugin.github_repo_name}`,
},
},
};
});
alfy.output(items);
});