Skip to content

Commit 8fabeee

Browse files
committed
Add warning when using pdf and stdout. Improve log.
1 parent 45a7e64 commit 8fabeee

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

gtt-log.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,13 @@ Fs.readDir(config.frameDir).forEach(file => {
3131
times[date] += Math.ceil(frame.duration);
3232
});
3333

34-
_.each(frames, (frames, date) => {
34+
Object.keys(frames).sort().forEach(date => {
35+
if (!frames.hasOwnProperty(date)) return;
36+
3537
console.log(`${moment(date).format('MMMM Do YYYY')} (${toHumanReadable(times[date])})`.green);
36-
frames
38+
frames[date]
3739
.sort((a, b) => moment(a.start).isBefore(moment(b.start)) ? -1 : 1)
3840
.forEach(frame => {
39-
console.log(` ${frame.id} ${moment(frame.start).format('HH:mm').green} to ${moment(frame.stop).format('HH:mm').green}\t${toHumanReadable(frame.duration)}\t${frame.project.magenta}\t${(frame.resource.type + ' #' + frame.resource.id).blue}`)
41+
console.log(` ${frame.id} ${moment(frame.start).format('HH:mm').green} to ${moment(frame.stop).format('HH:mm').green}\t${toHumanReadable(frame.duration)}\t\t${frame.project.magenta}\t\t${(frame.resource.type + ' #' + frame.resource.id).blue}`)
4042
});
4143
});

gtt-report.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@ if ((config.get('report').includes('merge_requests') && !config.get('query').inc
9797
if (!Output[config.get('output')]) {
9898
Cli.error(`The output ${config.get('output')} doesn't exist`);
9999
}
100+
if (config.get('output') === 'pdf' && !config.get('file')) {
101+
Cli.error(`Cannot output a pdf to stdout`);
102+
}
100103
if (!config.get('from').isValid()) {
101104
Cli.error(`FROM is not in a valid ISO date format.`);
102105
}

0 commit comments

Comments
 (0)