-
Notifications
You must be signed in to change notification settings - Fork 3
/
main.go
32 lines (26 loc) · 614 Bytes
/
main.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 main
import (
"fmt"
"os"
"github.com/flanksource/apm-hub/cmd"
"github.com/spf13/cobra"
)
var (
version = "dev"
commit = "none" //nolint:staticcheck,unused
date = "unknown" //nolint:staticcheck,unused
)
func main() {
cmd.Root.AddCommand(&cobra.Command{
Use: "version",
Short: "Print the version of apm-hub",
Args: cobra.MinimumNArgs(0),
Run: func(cmd *cobra.Command, args []string) {
fmt.Println(version)
},
})
cmd.Root.SetUsageTemplate(cmd.Root.UsageTemplate() + fmt.Sprintf("\nversion: %s\n ", version))
if err := cmd.Root.Execute(); err != nil {
os.Exit(1)
}
}