Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add changelog modifier callback to run function #922

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading