feat: output generated changelog blurb to both stdout and file for further processing #643
Closed
1 task done
Labels
feature/request
New feature or request
Is there an existing issue or pull request for this?
Feature description
Currently when
--prepend
is provided git-cliff will output the generated CHANGELOG section for the desired release to the file that is provided through--prepend
. It would be nice if it could also be send to the STDOUT through a flag so it can be picked up for further processing. It should be noted that if--prepend
is not provided then git-cliff does print to stdout.The motivation for this feature is that I could then use it for @favware/cliff-jumper to capture it and send it to the body of a GitHub release when calling the Create Release API endpoint. Currently, my CLI stops after updating the changelog and creating the Git tag locally, but if I can capture the release body I can make it possible to push the Git tag to the remote repository and create a release from that tag so a full release flow can be automated.
Desired solution
--stdout
, which when paired with--prepend ./CHANGELOG.md
will write to both theCHANGELOG.md
to print to stdout. Documentation would be able to clarify what the behaviour is of combining these 2 options.--output /dev/stdout/ --output ./CHANGELOG.md
. The equivalent of only--prepend ./CHANGELOG.md
would then be--prepend ./CHANGELOG.md --output ./CHANGELOG.md
--output
is not provided the current behaviour is retained, however in my opinion this becomes confusing because then what is going to happen if the user provides options like--prepend ./CHANGELOG.md --output ./CHANGELOG.md
/dev/stdout/
, I do not know for sure if this will work for Windows users. I would prefer if I do not have to do OS checking in @favware/cliff-jumper to account for this. With the former solution of--stdout
the advantage is that as a user of git-cliff I do not need to think about how exactly I can write to stdout for my operating system as git-cliff will automatically do that.Alternatives considered
Running git-cliff twice, first to print to stdout without
--prepend
and then toCHANGELOG.md
file with--prepend
. This is less ideal because of the "run twice" factor.Additional context
Also discussed on Discord here: https://discord.com/channels/1093977388892819553/1093978266135707668/1237529889113112607
The text was updated successfully, but these errors were encountered: