Show percentage in changelog generator example

This commit is contained in:
Héctor Ramón Jiménez 2025-12-03 05:23:46 +01:00
parent 4fc97c2ba6
commit 82544c39ca
No known key found for this signature in database
GPG key ID: 7CC46565708259A7

View file

@ -241,15 +241,13 @@ impl Generator {
} => {
let progress = {
let total = pending.len() + changelog.len();
let percent = 100.0 * changelog.len() as f32 / total as f32;
let bar = progress_bar(
0.0..=1.0,
changelog.len() as f32 / total as f32,
)
.style(progress_bar::secondary);
let bar = progress_bar(0.0..=100.0, percent)
.style(progress_bar::secondary);
let label = text!(
"{amount_reviewed} / {total}",
"{amount_reviewed} / {total} ({percent:.0}%)",
amount_reviewed = changelog.len()
)
.font(Font::MONOSPACE)
@ -326,7 +324,8 @@ impl Generator {
"Type a changelog entry title...",
title,
)
.on_input(Message::TitleChanged);
.on_input(Message::TitleChanged)
.on_submit(Message::Next);
let category = pick_list(
changelog::Category::ALL,