Skip to content

Commit f2d7ea6

Browse files
committed
Add version subcommand to release-notes tool
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 <sgrunert@redhat.com>
1 parent 1fe98d2 commit f2d7ea6

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

cmd/release-notes/main.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import (
3232
"sigs.k8s.io/mdtoc/pkg/mdtoc"
3333
"sigs.k8s.io/release-sdk/git"
3434
"sigs.k8s.io/release-utils/log"
35+
"sigs.k8s.io/release-utils/version"
3536
)
3637

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

@@ -187,6 +187,8 @@ func main() {
187187
addGenerate(cmd)
188188
addCheckPR(cmd)
189189

190+
cmd.AddCommand(version.WithFont("slant"))
191+
190192
hackDefaultSubcommand(cmd)
191193

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

0 commit comments

Comments
 (0)