-
Notifications
You must be signed in to change notification settings - Fork 0
/
title.go
32 lines (26 loc) · 899 Bytes
/
title.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package cmd
import (
"fmt"
"github.com/nitschmann/release-log/internal/app/config"
gitServ "github.com/nitschmann/release-log/internal/app/git/service"
"github.com/spf13/cobra"
)
func newTitleCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "title",
Aliases: []string{"t", "release-title"},
Short: "Prints the title of the new release",
Long: "Prints the title of the new release",
Run: func(cmd *cobra.Command, args []string) {
versionTagService := gitServ.NewVersionTagService(GitService, config.Get().FirstVersion)
newVersionTag, err := versionTagService.CreateNew(config.Get().NewVersion)
if err != nil {
printCliErrorAndExit(err)
}
releaseService := gitServ.NewReleaseService(GitService, config.Get().GitRemote, config.Get().GitRepoURL)
releaseTitle := releaseService.Title(newVersionTag)
fmt.Println(releaseTitle)
},
}
return cmd
}