Show percentage in changelog generator example
This commit is contained in:
parent
4fc97c2ba6
commit
82544c39ca
1 changed files with 6 additions and 7 deletions
|
|
@ -241,15 +241,13 @@ impl Generator {
|
||||||
} => {
|
} => {
|
||||||
let progress = {
|
let progress = {
|
||||||
let total = pending.len() + changelog.len();
|
let total = pending.len() + changelog.len();
|
||||||
|
let percent = 100.0 * changelog.len() as f32 / total as f32;
|
||||||
|
|
||||||
let bar = progress_bar(
|
let bar = progress_bar(0.0..=100.0, percent)
|
||||||
0.0..=1.0,
|
.style(progress_bar::secondary);
|
||||||
changelog.len() as f32 / total as f32,
|
|
||||||
)
|
|
||||||
.style(progress_bar::secondary);
|
|
||||||
|
|
||||||
let label = text!(
|
let label = text!(
|
||||||
"{amount_reviewed} / {total}",
|
"{amount_reviewed} / {total} ({percent:.0}%)",
|
||||||
amount_reviewed = changelog.len()
|
amount_reviewed = changelog.len()
|
||||||
)
|
)
|
||||||
.font(Font::MONOSPACE)
|
.font(Font::MONOSPACE)
|
||||||
|
|
@ -326,7 +324,8 @@ impl Generator {
|
||||||
"Type a changelog entry title...",
|
"Type a changelog entry title...",
|
||||||
title,
|
title,
|
||||||
)
|
)
|
||||||
.on_input(Message::TitleChanged);
|
.on_input(Message::TitleChanged)
|
||||||
|
.on_submit(Message::Next);
|
||||||
|
|
||||||
let category = pick_list(
|
let category = pick_list(
|
||||||
changelog::Category::ALL,
|
changelog::Category::ALL,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue