chore(cmd): pass max file size of changelog via options

This commit is contained in:
Felix Wiedmann
2021-05-08 20:45:24 +02:00
parent d66364e474
commit d9e5dc4515
3 changed files with 11 additions and 180 deletions

View File

@@ -10,6 +10,7 @@ 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")
changelogCmd.Flags().Int64("max-file-size", 10, "The max allowed file size for a changelog file. If the file size is larger, the current file will be moved to a new file named <filename>-01.md. The next changelog will be written to de default file.")
rootCmd.AddCommand(changelogCmd)
}
@@ -47,6 +48,11 @@ var changelogCmd = &cobra.Command{
return err
}
maxFileSize, err := cmd.Flags().GetInt64("max-file-size")
if err != nil {
return err
}
s, err := semanticrelease.New(readConfig(config), repository, configChecks)
if err != nil {
return err
@@ -67,6 +73,6 @@ var changelogCmd = &cobra.Command{
if err != nil {
return err
}
return s.WriteChangeLog(generatedChangelog.Content, file, overwrite)
return s.WriteChangeLog(generatedChangelog.Content, file, overwrite, maxFileSize)
},
}