-
-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathmain.go
More file actions
52 lines (47 loc) · 1.09 KB
/
main.go
File metadata and controls
52 lines (47 loc) · 1.09 KB
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
package main
import (
goversion "github.com/caarlos0/go-version"
"github.com/mroth/scmpuff/internal/cmd"
)
var (
version = ""
commit = ""
treeState = ""
date = ""
builtBy = ""
)
func main() {
cmd.Execute(
buildVersion(version, commit, date, builtBy, treeState),
)
}
var asciiArt = ` ________
______________ ___ ____ __ __/ __/ __/
/ ___/ ___/ __ ` + "`" + `__ \/ __ \/ / / / /_/ /_
(__ ) /__/ / / / / / /_/ / /_/ / __/ __/
/____/\___/_/ /_/ /_/ .___/\__,_/_/ /_/
/_/
`
func buildVersion(version, commit, date, builtBy, treeState string) goversion.Info {
return goversion.GetVersionInfo(
goversion.WithAppDetails("scmpuff", "Git by the numbers.", "https://github.com/mroth/scmpuff"),
goversion.WithASCIIName(asciiArt),
func(i *goversion.Info) {
if commit != "" {
i.GitCommit = commit
}
if treeState != "" {
i.GitTreeState = treeState
}
if date != "" {
i.BuildDate = date
}
if version != "" {
i.GitVersion = version
}
if builtBy != "" {
i.BuiltBy = builtBy
}
},
)
}