-
-
Notifications
You must be signed in to change notification settings - Fork 156
/
main.go
56 lines (48 loc) · 1.03 KB
/
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package main
import (
"os"
_ "embed"
goversion "github.com/caarlos0/go-version"
"github.com/goreleaser/nfpm/v2/internal/cmd"
)
// nolint: gochecknoglobals
var (
version = "dev"
treeState = ""
commit = ""
date = ""
builtBy = ""
)
const website = "https://nfpm.goreleaser.com"
//go:embed art.txt
var asciiArt string
func main() {
cmd.Execute(
buildVersion(version, commit, date, builtBy, treeState),
os.Exit,
os.Args[1:],
)
}
func buildVersion(version, commit, date, builtBy, treeState string) goversion.Info {
return goversion.GetVersionInfo(
goversion.WithAppDetails("nfpm", "a simple and 0-dependencies apk, arch linux, deb, ipk, and rpm packager written in Go", website),
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
}
},
)
}