Skip to content

Commit c641ebe

Browse files
committed
Add better errors up-front
1 parent 9b676c9 commit c641ebe

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/gtt-report.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ program
3535
.option('-q --query <query>', 'query the given data types: issues, merge_requests', collect, null)
3636
.option('-e --type <type>', 'specify the query type: project, user, group')
3737
.option('-r --report <report>', 'include in the report: stats, issues, merge_requests, records', collect, null)
38-
.option('-o --output <output>', 'use the given output', collect, null)
38+
.option('-o --output <output>', 'use the given output')
3939
.option('-l --file <file>', 'save report to the given file')
4040
.option('--subgroups', 'include sub groups')
4141
.option('--include_by_labels <labels>', 'only include issues that have the given labels', collect, null)
@@ -116,11 +116,14 @@ if ((config.get('report').includes('issues') && !config.get('query').includes('i
116116
if ((config.get('report').includes('merge_requests') && !config.get('query').includes('merge_requests'))) {
117117
Cli.warn(`Merge Requests are included in the report but not queried.`);
118118
}
119+
if (!config.get('project')) {
120+
Cli.error(`Missing project(s) or group(s) namespace. Try this: gtt report "username/project-name"`);
121+
}
119122
if (!Output[config.get('output')]) {
120-
Cli.error(`The output ${config.get('output')} doesn't exist`);
123+
Cli.error(`The output ${config.get('output')} doesn't exist. Available outputs: ${Object.keys(Output).join(',')}`);
121124
}
122125
if (config.get('output') === 'pdf' && !config.get('file')) {
123-
Cli.error(`Cannot output a pdf to stdout`);
126+
Cli.error(`Cannot output a pdf to stdout. You probably forgot to use the --file parameter`);
124127
}
125128
if (!config.get('from').isValid()) {
126129
Cli.error(`FROM is not in a valid ISO date format.`);

0 commit comments

Comments
 (0)