Skip to content

Commit 7715f4e

Browse files
author
Wolfgang Wohanka
committed
gtt-list: Added Type merge_request
1 parent bb01e47 commit 7715f4e

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/gtt-list.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const Tasks = require('./include/tasks');
1111
program
1212
.arguments('[project]')
1313
.option('--verbose', 'show verbose output')
14+
.option('-t, --type <type>', 'specify resource type: issue, merge_request')
1415
.option('-c, --closed', 'show closed issues (instead of opened only)')
1516
.option('--my', 'show only issues assigned to me')
1617
.parse(process.argv);
@@ -22,13 +23,13 @@ let config = new Config(process.cwd()),
2223
type = program.type ? program.type : 'issue',
2324
project = program.args[0];
2425

25-
tasks.list(project, program.closed ? 'closed' : 'opened', program.my)
26+
tasks.list(project, program.closed ? 'closed' : 'opened', program.my, program.type)
2627
.then(issues => {
2728
let table = new Table({
2829
style : {compact : true, 'padding-left' : 1}
2930
});
3031
if (issues.length == 0) {
31-
console.log("No issues found.");
32+
console.log("No ${programm.type}s found.");
3233
}
3334
issues.forEach(issue => {
3435
table.push([issue.iid.toString().magenta, issue.title.green + "\n" + issue.data.web_url.gray, issue.state])

src/include/tasks.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,9 @@ class tasks {
196196
});
197197
}
198198

199-
list(project, state, my) {
199+
list(project, state, my, type) {
200200
this.config.set('project', project);
201-
return (new classes['issue'](this.config, {})).list(this.config.get('project'), state, my);
201+
return (new classes[type](this.config, {})).list(this.config.get('project'), state, my);
202202
}
203203

204204
/**

0 commit comments

Comments
 (0)