mirror of
https://github.com/goreleaser/nfpm
synced 2024-06-08 12:36:30 +02:00
f8c8ab0057
* feat: use goversion lib Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com> * fix: trailing empty line Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com> --------- Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
57 lines
1.0 KiB
Go
57 lines
1.0 KiB
Go
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 deb, rpm, apk and arch linux 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
|
|
}
|
|
},
|
|
)
|
|
}
|