How to use the stdout-update/lib/wrapper.Wrapper.EMPTY function in stdout-update

To help you get started, we’ve selected a few stdout-update examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github keindev / tasktree / src / progress-bar.ts View on Github external
public render(theme: Theme): string {
        const length = Math.round(this.width * this.getRatio());
        const type = Theme.type(this.status);
        let blocks = Wrapper.EMPTY.padStart(length, this.completeBlock);

        if (!this.isCompleted() && this.gradient) {
            blocks = theme.gradient(blocks, {
                position: this.getRatio(),
                begin: Theme.type(this.status),
                end: IndicationType.Success,
            });
        } else {
            blocks = theme.paint(blocks, type);
        }

        let result = this.template
            .replace(TemplateToken.Current, this.current.toString())
            .replace(TemplateToken.Total, this.total.toString())
            .replace(TemplateToken.Percent, `${this.getPercent().toFixed(ProgressBar.MIN_POINT_POSITION)}%`)
            .replace(
github keindev / tasktree / src / progress-bar.ts View on Github external
.replace(TemplateToken.Current, this.current.toString())
            .replace(TemplateToken.Total, this.total.toString())
            .replace(TemplateToken.Percent, `${this.getPercent().toFixed(ProgressBar.MIN_POINT_POSITION)}%`)
            .replace(
                TemplateToken.ETA,
                (this.getETA() / ProgressBar.TIME_DIMENSION).toFixed(ProgressBar.MAX_POINT_POSITION)
            )
            .replace(TemplateToken.Rate, Math.round(this.getRate()).toString())
            .replace(
                TemplateToken.Elapsed,
                (this.getElapsed() / ProgressBar.TIME_DIMENSION).toFixed(ProgressBar.MAX_POINT_POSITION)
            )
            .replace(
                TemplateToken.Bar,
                Theme.join(
                    Wrapper.EMPTY,
                    blocks,
                    theme.paint(
                        Wrapper.EMPTY.padStart(this.width - length, this.incompleteBlock),
                        IndicationType.Subtask
                    )
                )
            );

        this.tokens.forEach((value: string, key: string): void => {
            result = result.replace(`:${key}`, value);
        });

        return this.badges ? Theme.join(Wrapper.SPACE, result, theme.badge(type)) : result;
    }
}
github keindev / tasktree / src / theme.ts View on Github external
public title(task: Task, level: number): string {
        const type = Theme.type(task.getStatus(), task.haveSubtasks());
        const badge = this.badge(type);
        const symbol = this.symbol(type);
        let prefix = Wrapper.EMPTY;

        if (level)
            prefix = task.haveSubtasks() ? this.symbol(IndicationType.Subtask) : this.symbol(IndicationType.Default);

        return Theme.indent(level, prefix, symbol, task.getText(), badge);
    }

stdout-update

Updates the previous output in the terminal. Useful for correct rendering progress bars, animations, etc.

MIT
Latest version published 9 months ago

Package Health Score

66 / 100
Full package analysis