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:
parent
8f623efd45
commit
570bd1fa2b
2 changed files with 18 additions and 3 deletions
5
.changeset/cool-badgers-allow.md
Normal file
5
.changeset/cool-badgers-allow.md
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'@emigrate/cli': patch
|
||||
---
|
||||
|
||||
The default reporter now prints the full command output once a command is done (in interactive mode) so that the full output is visible no matter the size of the terminal window.
|
||||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue