Skip to content

Commit 6d557b3

Browse files
Donation suggestion should only pop up when the vec is not empty
1 parent a80bdbe commit 6d557b3

File tree

2 files changed

+26
-14
lines changed

2 files changed

+26
-14
lines changed

src/subcommands/add.rs

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,19 @@ pub async fn modrinth(
9595
}
9696

9797
if let Some(donation_urls) = project.donation_urls {
98-
println!(
99-
"Consider supporting the mod creator on {}",
100-
donation_urls
101-
.iter()
102-
.map(|this| format!("{} ({})", this.platform.bold(), this.url.blue().underline()))
103-
.format(" or ")
104-
);
98+
if !donation_urls.is_empty() {
99+
println!(
100+
"Consider supporting the mod creator on {}",
101+
donation_urls
102+
.iter()
103+
.map(|this| format!(
104+
"{} ({})",
105+
this.platform.bold(),
106+
this.url.blue().underline()
107+
))
108+
.format(" or ")
109+
);
110+
}
105111
}
106112

107113
Ok(())

src/subcommands/modpack/add.rs

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,19 @@ pub async fn modrinth(
9191
);
9292
}
9393
if let Some(donation_urls) = project.donation_urls {
94-
println!(
95-
"Consider supporting the mod creator on {}",
96-
donation_urls
97-
.iter()
98-
.map(|this| format!("{} ({})", this.platform.bold(), this.url.blue().underline()))
99-
.format(", ")
100-
);
94+
if !donation_urls.is_empty() {
95+
println!(
96+
"Consider supporting the mod creator on {}",
97+
donation_urls
98+
.iter()
99+
.map(|this| format!(
100+
"{} ({})",
101+
this.platform.bold(),
102+
this.url.blue().underline()
103+
))
104+
.format(", ")
105+
);
106+
}
101107
}
102108
config.modpacks.push(Modpack {
103109
name: project.title,

0 commit comments

Comments
 (0)