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

Add dedicated --html-file output option to krel changelog #1042

Merged
merged 1 commit into from
Jan 28, 2020
Merged
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
15 changes: 10 additions & 5 deletions cmd/krel/cmd/changelog.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,11 @@ the golang based 'release-notes' tool:
}

type changelogOptions struct {
tag string
bucket string
tars string
token string
tag string
bucket string
tars string
token string
htmlFile string
}

var changelogOpts = &changelogOptions{}
Expand All @@ -96,7 +97,8 @@ func init() {
)
changelogCmd.PersistentFlags().StringVar(&changelogOpts.bucket, "bucket", "kubernetes-release", "Specify gs bucket to point to in generated notes")
changelogCmd.PersistentFlags().StringVar(&changelogOpts.tag, tagFlag, "", "The version tag of the release, for example v1.17.0-rc.1")
changelogCmd.PersistentFlags().StringVar(&changelogOpts.tars, tarsFlag, "", "Directory of tars to sha512 sum for display")
changelogCmd.PersistentFlags().StringVar(&changelogOpts.tars, tarsFlag, "", "Directory of tars to SHA512 sum for display")
changelogCmd.PersistentFlags().StringVar(&changelogOpts.htmlFile, "html-file", "", "The target html file to be written. If empty, then it will be CHANGELOG-x.y.html in the current path.")

if err := changelogCmd.MarkPersistentFlagRequired(tagFlag); err != nil {
logrus.Fatal(err)
Expand Down Expand Up @@ -288,6 +290,9 @@ func writeMarkdown(repo *git.Repo, toc, markdown string, tag semver.Version) err
}

func htmlChangelogFilename(tag semver.Version) string {
if changelogOpts.htmlFile != "" {
return changelogOpts.htmlFile
}
return changelogFilename(tag, "html")
}

Expand Down