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

fix(args): allow -o and -p together if they point to different files #653

Merged
merged 3 commits into from
May 26, 2024
Merged
Show file tree
Hide file tree
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
9 changes: 9 additions & 0 deletions git-cliff/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,15 @@ pub fn run(mut args: Opt) -> Result<()> {
)));
}
}
if args.output.is_some() &&
args.prepend.is_some() &&
args.output.as_ref() == args.prepend.as_ref()
{
return Err(Error::ArgumentError(String::from(
"'-o' and '-p' can only be used together if they point to different \
files",
)));
}
if args.body.is_some() {
config.changelog.body.clone_from(&args.body);
}
Expand Down
1 change: 1 addition & 0 deletions website/docs/usage/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ Prepend new changes to an existing changelog file:
```bash
# 1- changelog header is removed from CHANGELOG.md
# 2- new entries are prepended to CHANGELOG.md without footer part
# the --prepend option is incompatible with -o (output) if the file paths are equal
git cliff --unreleased --tag 1.0.0 --prepend CHANGELOG.md
```

Expand Down
Loading