Skip to content

Commit

Permalink
Add version subcommand to release-notes tool
Browse files Browse the repository at this point in the history
It's not possible to display the version of the `release-notes` right
now. This is now being fixed by introducing the `version` subcommand in
the same way we do it for `krel`.

Signed-off-by: Sascha Grunert <[email protected]>
  • Loading branch information
saschagrunert committed Feb 22, 2024
1 parent 1fe98d2 commit f2d7ea6
Showing 1 changed file with 4 additions and 2 deletions.
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

0 comments on commit f2d7ea6

Please sign in to comment.