Skip to content

Commit

Permalink
feat: add changelog modifier callback to run function
Browse files Browse the repository at this point in the history
  • Loading branch information
weichweich committed Oct 17, 2024
1 parent 82b10ac commit 8462d82
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion git-cliff/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,14 @@ fn process_repository<'a>(
}

/// Runs `git-cliff`.
pub fn run(mut args: Opt) -> Result<()> {
pub fn run(args: Opt) -> Result<()> {
run_with_changelog_modifier(args, |_| Ok(()))
}

pub fn run_with_changelog_modifier(
mut args: Opt,
changelog_modifier: impl FnOnce(&mut Changelog) -> Result<()>,
) -> Result<()> {
// Check if there is a new version available.
#[cfg(feature = "update-informer")]
check_new_version();
Expand Down Expand Up @@ -590,6 +597,7 @@ pub fn run(mut args: Opt) -> Result<()> {
}
Changelog::new(releases, &config)?
};
changelog_modifier(&mut changelog)?;

// Print the result.
let mut out: Box<dyn io::Write> = if let Some(path) = &output {
Expand Down

0 comments on commit 8462d82

Please sign in to comment.