Skip to content

Commit

Permalink
simplify cmd_badges
Browse files Browse the repository at this point in the history
  • Loading branch information
orsinium committed Nov 9, 2024
1 parent b40ec7a commit ba5b357
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/commands/badges.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,14 @@ pub fn cmd_badges(vfs: &Path, args: &BadgesArgs) -> Result<()> {
let mut badges: Vec<_> = badges.badges.iter().zip(1..).collect();
badges.sort_by_key(|(badge, _id)| badge.position);

// display badges
display_badges(&badges, &stats, args)
}

fn display_badges(
badges: &[(&firefly_types::Badge<'_>, usize)],
stats: &firefly_types::Stats,
args: &BadgesArgs,
) -> Result<()> {
for (badge, id) in badges {
let Some(progress) = stats.badges.get(id - 1) else {
bail!("there are fewer badges in stats file than in the rom");
Expand Down

0 comments on commit ba5b357

Please sign in to comment.