Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private render(status?: string, showProgress: boolean = true): void {
const thisRender = `${status}.${this.completedFiles.length}.${this.failedFiles}.${this.files.length}`;
if (this.lastRender === thisRender) {
return;
}
this.lastRender = thisRender;
const complete = this.completedFiles.length + this.failedFiles.length;
const barWidth = 25;
const barFilled = Math.min(barWidth, Math.floor((complete / this.files.length) * barWidth));
const barSpace = barWidth - barFilled;
const bar = `${chalk.cyan(hamburger.repeat(barFilled))}${chalk.grey(
hamburger.repeat(barSpace)
)}`; // █
status = status ? status : `${chalk.bold.cyan("Get a cup of coffee while I'm working")}`;
this.terminalLines[1].text = `${DynamicTerminal.SPINNER} ${status}`;
this.terminalLines[3].text = showProgress ? `${bar} ${complete}/${this.files.length}` : "";
if (this.terminal) {
this.terminal.update(this.terminalLines);
}
}
private render(status?: string, showProgress: boolean = true): void {
const thisRender = `${status}.${this.completedFiles.length}.${this.failedFiles}.${this.files.length}`;
if (this.lastRender === thisRender) {
return;
}
this.lastRender = thisRender;
const complete = this.completedFiles.length + this.failedFiles.length;
const barWidth = 25;
const barFilled = Math.min(barWidth, Math.floor((complete / this.files.length) * barWidth));
const barSpace = barWidth - barFilled;
const bar = `${chalk.cyan(hamburger.repeat(barFilled))}${chalk.grey(
hamburger.repeat(barSpace)
)}`; // █
status = status ? status : `${chalk.bold.cyan("Get a cup of coffee while I'm working")}`;
this.terminalLines[1].text = `${DynamicTerminal.SPINNER} ${status}`;
this.terminalLines[3].text = showProgress ? `${bar} ${complete}/${this.files.length}` : "";
if (this.terminal) {
this.terminal.update(this.terminalLines);
}
}