Skip to content

Commit a28a7a9

Browse files
committed
Initial Commit ✨
0 parents  commit a28a7a9

File tree

5 files changed

+69
-0
lines changed

5 files changed

+69
-0
lines changed

.editorconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
root = true
2+
3+
[*]
4+
end_of_line = lf
5+
insert_final_newline = true
6+
charset = utf-8
7+
indent_style = space
8+
indent_size = 2
9+

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules/
2+
.DS_Store
3+
npm-debug.log

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# dext-github-plugin
2+
3+
> Dext plugin to search for Github repositories.
4+
5+
## Install
6+
7+
$ dpm install dext-github-plugin
8+
9+
## Usage
10+
11+
In Dext, type `gh`, then your query.
12+
13+
## License
14+
15+
MIT © [Vu Tran](https://github.com/vutran/)

index.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
const got = require('got');
2+
3+
module.exports = {
4+
keyword: 'gh',
5+
action: 'openurl',
6+
output: q => new Promise(resolve => {
7+
const opts = {
8+
query: {
9+
q: `${q} in:name`,
10+
},
11+
json: true,
12+
};
13+
got('https://api.github.com/search/repositories', opts)
14+
.then(res => {
15+
if (res.body) {
16+
const items = res.body.items
17+
.map(i => Object.assign({}, {
18+
title: i.full_name,
19+
subtitle: i.description,
20+
arg: i.html_url,
21+
icon: {
22+
path: i.owner.avatar_url,
23+
},
24+
}))
25+
.slice(0, 20);
26+
resolve({ items });
27+
}
28+
});
29+
}),
30+
};

package.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"name": "dext-github-plugin",
3+
"version": "0.0.0",
4+
"description": "Dext plugin to search for Github repositories.",
5+
"keywords": ["dext", "dext-plugin", "github", "gh", "repository"],
6+
"main": "index.js",
7+
"author": "Vu Tran <vu@vu-tran.com>",
8+
"license": "MIT",
9+
"dependencies": {
10+
"got": "^6.3.0"
11+
}
12+
}

0 commit comments

Comments
 (0)