-
-
Notifications
You must be signed in to change notification settings - Fork 171
/
cmd_version.go
53 lines (43 loc) · 957 Bytes
/
cmd_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
44
45
46
47
48
49
50
51
52
53
package main
import (
"fmt"
"runtime"
"github.com/spf13/cobra"
)
func versionCmd() *cobra.Command {
c := &cobra.Command{
Use: "version",
Short: "Version information",
Run: cmdVersion,
}
return c
}
func cmdVersion(cmd *cobra.Command, args []string) {
fmt.Printf("%s\n", BuildDetails())
}
func BuildDetails() string {
if version == "" {
return `
GraphJin (unknown version)
For documentation, visit https://graphjin.com
To build with version information please use the Makefile
> git clone https://github.com/dosco/graphjin
> cd graphjin && make install
Licensed under the Apache Public License 2.0
Copyright 2019 Vikram Rangnekar
`
}
return fmt.Sprintf(`
GraphJin %v
For documentation, visit https://graphjin.com
Commit SHA-1 : %v
Commit timestamp : %v
Go version : %v
Licensed under the Apache Public License 2.0
Copyright 2019 Vikram Rangnekar
`,
version,
commit,
date,
runtime.Version())
}