forked from ndu2/gitlab-time-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgtt-list.js
More file actions
executable file
·39 lines (32 loc) · 1.15 KB
/
gtt-list.js
File metadata and controls
executable file
·39 lines (32 loc) · 1.15 KB
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
const program = require('commander');
const colors = require('colors');
const moment = require('moment');
const Table = require('cli-table');
const Config = require('./include/file-config');
const Cli = require('./include/cli');
const Tasks = require('./include/tasks');
program
.arguments('[project]')
.option('--verbose', 'show verbose output')
.option('-c, --closed', 'show closed issues (instead of opened only)')
.option('--my', 'show only issues assigned to me')
.parse(process.argv);
Cli.verbose = program.verbose;
let config = new Config(process.cwd()),
tasks = new Tasks(config),
type = program.type ? program.type : 'issue',
project = program.args[0];
tasks.list(project, program.closed ? 'closed' : 'opened', program.my)
.then(issues => {
let table = new Table({
style : {compact : true, 'padding-left' : 1}
});
if (issues.length == 0) {
console.log("No issues found.");
}
issues.forEach(issue => {
table.push([issue.iid.toString().magenta, issue.title.green + "\n" + issue.data.web_url.gray, issue.state])
})
console.log(table.toString());
})
.catch(error => Cli.error(error));