feat(changelog): prepend a changelog to a file as default, use --overwrite to overwrite the whole file

BREAKING CHANGE: changelog command will now prepend changelogs to the changelog-file
This commit is contained in:
fwiedmann
2021-03-11 22:12:44 +01:00
committed by Felix Wiedmann
parent 155a16ddd5
commit a054cf9a60
2 changed files with 25 additions and 6 deletions

View File

@@ -8,6 +8,7 @@ import (
func init() {
changelogCmd.Flags().Bool("checks", false, "Check for missing values and envs")
changelogCmd.Flags().Bool("overwrite", false, "Overwrite the content of the changelog. Default is to prepend the new changelog to the existing file.")
changelogCmd.Flags().StringP("out", "o", "CHANGELOG.md", "Name of the file")
rootCmd.AddCommand(changelogCmd)
}
@@ -31,6 +32,11 @@ var changelogCmd = &cobra.Command{
return err
}
overwrite, err := cmd.Flags().GetBool("overwrite")
if err != nil {
return err
}
file, err := cmd.Flags().GetString("out")
if err != nil {
return err
@@ -61,7 +67,6 @@ var changelogCmd = &cobra.Command{
if err != nil {
return err
}
return s.WriteChangeLog(generatedChangelog.Content, file)
return s.WriteChangeLog(generatedChangelog.Content, file, overwrite)
},
}