-
Notifications
You must be signed in to change notification settings - Fork 11
/
cli.js
44 lines (37 loc) · 850 Bytes
/
cli.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
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env node
'use strict'
var meow = require('meow')
var hacktoberFest = require('./main.js')
const cli = meow(`
Usage:
$ npx hacktoberfeststats <username from GitHub>
Options
--help, -h Get this beautiful help panel
--year, -y Specify the year you want to get stats from. Useful if you want to retrieve historic data from previous hacktoberfest events.
Examples
$ npx hacktoberfeststats MatejMecka --year 2019
`,{
flags: {
year: {
type: 'number',
alias: 'y',
default: 0,
},
help: {
type: 'boolean',
alias: 'h',
},
},
})
if (cli.flags.help) {
cli.showHelp(0)
}
hacktoberFest
.getHacktoberfestStats(cli.input[0], cli.flags.year)
.then((stats) => {
console.log(stats)
})
.catch((error) => {
console.error(error.message)
process.exit(1)
})