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 version subcommand to release-notes tool #3478

Merged
merged 1 commit into from
Feb 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions cmd/release-notes/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import (
"sigs.k8s.io/mdtoc/pkg/mdtoc"
"sigs.k8s.io/release-sdk/git"
"sigs.k8s.io/release-utils/log"
"sigs.k8s.io/release-utils/version"
)

type releaseNotesOptions struct {
Expand Down Expand Up @@ -156,8 +157,7 @@ func WriteReleaseNotes(releaseNotes *notes.ReleaseNotes) (err error) {
// versions of release-notes.
func hackDefaultSubcommand(cmd *cobra.Command) {
if len(os.Args) > 1 {
// We accept --version and "completion"
if os.Args[1] == "completion" || os.Args[1] == "--version" || os.Args[1] == "--help" {
if os.Args[1] == "completion" {
return
}

Expand Down Expand Up @@ -187,6 +187,8 @@ func main() {
addGenerate(cmd)
addCheckPR(cmd)

cmd.AddCommand(version.WithFont("slant"))

hackDefaultSubcommand(cmd)

if err := cmd.Execute(); err != nil {
Expand Down