Skip to content

Commit

Permalink
update progress bar
Browse files Browse the repository at this point in the history
  • Loading branch information
Zyie committed Apr 29, 2024
1 parent 32aa08f commit c7883a8
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion packages/core/src/logger/render.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,19 @@ export function resetWindow()
}

const progressBar = new cliProgress.SingleBar({
format: `${chalk.green('{bar}')} {percentage}%`,
format: `| ${chalk.green('{bar}')} | {percentage}%`,
barIncompleteString: '\u25A0',
formatBar: (progress, options) =>
{
// calculate barsize
const completeSize = Math.round(progress * options.barsize!);
const incompleteSize = options.barsize! - completeSize;

// generate bar string
return chalk.green(options.barCompleteString!.substr(0, completeSize))
+ options.barGlue
+ chalk.grey(options.barIncompleteString!.substr(0, incompleteSize));
}
}, cliProgress.Presets.rect);

export function startProgress()
Expand Down

0 comments on commit c7883a8

Please sign in to comment.