-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommand.js
More file actions
23 lines (20 loc) · 737 Bytes
/
command.js
File metadata and controls
23 lines (20 loc) · 737 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
const program = require('commander');
const Github = require('./github');
program
.version('0.0.1')
.option('-o, --option', 'option description')
.option('-m, --more', 'we can have as many options as we want')
.option('-i, --input [optional]', 'optional user input')
.option('-I, --another-input <required>', 'required user input');
program
.command('search <term>')
.description('Search on github')
.action((term) => {
let github = new Github();
github.searchOnRepositories(term, function (response) {
response.forEach(element => {
process.stdout.write(element[0] + ": " + element[1] + "\n");
});
});
});
program.parse(process.argv);