forked from kevva/github-gists
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcli.js
More file actions
executable file
·36 lines (31 loc) · 685 Bytes
/
cli.js
File metadata and controls
executable file
·36 lines (31 loc) · 685 Bytes
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
34
35
36
#!/usr/bin/env node
'use strict';
var chalk = require('chalk');
var meow = require('meow');
var githubGists = require('./');
var cli = meow({
help: [
'Usage',
' $ github-gists kevva',
' $ github-gists kevva --token 523ef69119eadg12',
'',
'Options',
' -t, --token GitHub authentication token'
].join('\n')
}, {
string: ['token'],
alias: {t: 'token'}
});
if (!cli.input[0]) {
console.error('User required');
process.exit(1);
}
githubGists(cli.input[0], cli.flags, function (err, data) {
if (err) {
console.error(err.message);
process.exit(1);
}
data.forEach(function (gist) {
console.log(gist.description + ' ' + chalk.dim(gist.html_url));
});
});