-
Notifications
You must be signed in to change notification settings - Fork 6
/
info.go
43 lines (37 loc) · 965 Bytes
/
info.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
package cmd
import (
"fmt"
"runtime"
"strings"
"github.com/spf13/cobra"
)
var (
LAST_CHANGE = "LIVE"
REVISION = "DEV"
LIBRARY_REVISION = "DEV"
PHRASE_CLIENT_VERSION = "DEV"
)
func init() {
initInfo()
}
func initInfo() {
var infoCmd = &cobra.Command{
Use: "info",
Short: "Info about CLI client for phrase",
Long: "",
Run: func(cmd *cobra.Command, args []string) {
fmt.Print(GetInfo())
},
}
rootCmd.AddCommand(infoCmd)
}
func GetInfo() string {
info := []string{
fmt.Sprintf("Phrase Strings client version: %s", PHRASE_CLIENT_VERSION),
fmt.Sprintf("Phrase Strings client revision: %s", REVISION),
fmt.Sprintf("Phrase Strings library revision: %s", LIBRARY_REVISION),
fmt.Sprintf("Last change at: %s", LAST_CHANGE),
fmt.Sprintf("Go version: %s", runtime.Version()),
}
return fmt.Sprintf("%s\n", strings.Join(info, "\n"))
}