feat(cli): make the default reporter print the full command output when done

In interactive mode the output is normally clipped to the number of lines that the current terminal window can show without scrolling
so to remedy that the full command output is now printed to the console when done
This commit is contained in:
Joakim Carlstein 2023-11-22 14:35:07 +01:00
parent 8f623efd45
commit 570bd1fa2b
2 changed files with 18 additions and 3 deletions

View file

@ -295,7 +295,7 @@ class DefaultFancyReporter implements Required<EmigrateReporter> {
}
}
#render(): void {
#render(flush = false): void {
const parts = [
getTitle(this.#parameters),
getHeaderMessage(this.#migrations, this.#lockedMigrations),
@ -303,7 +303,17 @@ class DefaultFancyReporter implements Required<EmigrateReporter> {
getSummary(this.#parameters.command, this.#migrations),
getError(this.#error),
];
logUpdate('\n' + parts.filter(Boolean).join('\n\n') + '\n');
const output = '\n' + parts.filter(Boolean).join('\n\n') + '\n';
if (flush) {
logUpdate.clear();
logUpdate.done();
console.log(output);
return;
}
logUpdate(output);
}
#start(): void {
@ -319,7 +329,7 @@ class DefaultFancyReporter implements Required<EmigrateReporter> {
this.#interval = undefined;
}
this.#render();
this.#render(true);
}
}