Skip to content

Commit

Permalink
feat: show the names of the tags to be created
Browse files Browse the repository at this point in the history
  • Loading branch information
lolbinarycat committed Jun 1, 2024
1 parent 569b6fb commit 21505e9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/steps/release.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ impl ReleaseStep {
super::owner::ensure_owners(&selected_pkgs, dry_run)?;

// STEP 5: Tag
super::tag::show_status(&selected_pkgs);
super::tag::tag(&selected_pkgs, dry_run)?;

// STEP 6: git push
Expand Down
16 changes: 16 additions & 0 deletions src/steps/tag.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ impl TagStep {
)?;

// STEP 1: Release Confirmation
show_status(&selected_pkgs);
super::confirm("Tag", &selected_pkgs, self.no_confirm, dry_run)?;

// STEP 5: Tag
Expand Down Expand Up @@ -189,3 +190,18 @@ pub fn tag(pkgs: &[plan::PackageRelease], dry_run: bool) -> Result<(), CliError>

Ok(())
}

// this is split out into a seperate function since it needs to be run before
// the confirmation check when running the tag step as a seperate command.
pub fn show_status(pkgs: &[plan::PackageRelease]) {
let mut tags: Vec<_> = pkgs
.iter()
.map(|pkg| pkg.planned_tag.as_ref().map(|tag| tag.as_str()))
// Option implements IntoIterator, so this
// removes None while unwrapping Some
.flatten()
.collect();
tags.sort();
tags.dedup();
let _ = crate::ops::shell::status("Tagging", tags.join(", "));
}

0 comments on commit 21505e9

Please sign in to comment.