Galaxy-brained newline intersperse function

Itertools already has an intersperse method for me. Why would I build my
own when I can do this? There's even a `fold()` over the units that come
out of the print routine.
This commit is contained in:
2025-07-02 22:29:07 -05:00
parent 8120cb0489
commit d94c350cde
2 changed files with 9 additions and 3 deletions

View File

@@ -6,6 +6,7 @@ use gt_tool::structs::release::{CreateReleaseOption, Release};
use clap::Parser;
use itertools::Itertools;
use reqwest::header;
use reqwest::header::ACCEPT;
@@ -36,9 +37,13 @@ async fn main() -> Result<(), gt_tool::Error> {
// Print in reverse order so the newest items are closest to the
// user's command prompt. Otherwise the newest item scrolls off the
// screen and can't be seen.
for release in releases.iter().rev() {
println!("{}", release);
}
let _ = releases
.iter()
.rev()
.map(|release| release.to_string())
.intersperse(String::from(""))
.map(|release| println!("{}", release))
.fold((), |_, _| () );
}
gt_tool::cli::Commands::CreateRelease {
name,