-
Notifications
You must be signed in to change notification settings - Fork 48
/
version.go
43 lines (32 loc) · 1.12 KB
/
version.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
37
38
39
40
41
42
43
// gRPC Runtime of CB-Spider.
// The CB-Spider is a sub-Framework of the Cloud-Barista Multi-Cloud Project.
// The CB-Spider Mission is to connect all the clouds with a single interface.
//
// * Cloud-Barista: https://github.com/cloud-barista
//
// by CB-Spider Team, 2020.09.
package cmd
import (
"fmt"
"runtime"
"github.com/spf13/cobra"
)
// ===== [ Constants and Variables ] =====
// ===== [ Types ] =====
// ===== [ Implementations ] =====
// ===== [ Private Functions ] =====
// ===== [ Public Functions ] =====
// NewVersionCmd - 버전 표시 기능을 수행하는 Cobra Command 생성
func NewVersionCmd() *cobra.Command {
versionCmd := &cobra.Command{
Use: "version",
Short: "This is a version command for spctl",
Long: "This is a version command for spctl",
Run: func(cmd *cobra.Command, args []string) {
fmt.Fprintf(cmd.OutOrStdout(), "spctl:\n Version: %s\n Commit SHA: %s\n Go version: %s\n"+
" OS/Arch: %s\n Build Time: %s\n Build User: %s\n",
Version, CommitSHA, runtime.Version(), fmt.Sprintf("%s/%s", runtime.GOOS, runtime.GOARCH), Time, User)
},
}
return versionCmd
}