-
Notifications
You must be signed in to change notification settings - Fork 13
/
root.go
36 lines (32 loc) · 990 Bytes
/
root.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
33
34
35
36
package cmd
import (
"github.com/jenkins-x-plugins/jx-changelog/pkg/cmd/create"
"github.com/jenkins-x/jx-helpers/v3/pkg/options"
"github.com/jenkins-x/jx-logging/v3/pkg/log"
"github.com/jenkins-x-plugins/jx-changelog/pkg/cmd/version"
"github.com/jenkins-x-plugins/jx-changelog/pkg/rootcmd"
"github.com/jenkins-x/jx-helpers/v3/pkg/cobras"
"github.com/spf13/cobra"
)
// Options a few common options we tend to use in command line tools
type Options struct {
options.BaseOptions
}
// Main creates the new command
func Main() *cobra.Command {
cmd := &cobra.Command{
Use: rootcmd.TopLevelCommand,
Short: "Command for working with Changelogs",
Run: func(cmd *cobra.Command, args []string) {
err := cmd.Help()
if err != nil {
log.Logger().Errorf(err.Error())
}
},
}
o := options.BaseOptions{}
o.AddBaseFlags(cmd)
cmd.AddCommand(cobras.SplitCommand(create.NewCmdChangelogCreate()))
cmd.AddCommand(cobras.SplitCommand(version.NewCmdVersion()))
return cmd
}