diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 1dcfb3a..da1035d 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -4,7 +4,7 @@ builds: main: ./cli/main env: - CGO_ENABLED=0 - ldflags: "-X savesecrets.org/slv.Version={{.Version}}" + ldflags: "-X savesecrets.org/slv.Version={{.Version}} -X savesecrets.org/slv.BuildDate={{.Date}} -X savesecrets.org/slv.Commit={{.Commit}}" targets: - darwin_amd64 - darwin_arm64 diff --git a/cli/internal/commands/version.go b/cli/internal/commands/version.go index 17dee3f..fa80aa9 100644 --- a/cli/internal/commands/version.go +++ b/cli/internal/commands/version.go @@ -2,6 +2,8 @@ package commands import ( "fmt" + "runtime" + "time" "github.com/spf13/cobra" "savesecrets.org/slv" @@ -9,7 +11,20 @@ import ( ) func showVersionInfo() { - fmt.Println(config.AppNameUpperCase, slv.Version) + buildAt := "unknown" + if builtAtTime, err := time.Parse(time.RFC3339, slv.BuildDate); err == nil { + builtAtLocalTime := builtAtTime.Local() + buildAt = builtAtLocalTime.Format("02 Jan 2006 03:04:05 PM MST") + } + fmt.Println(config.Art) + fmt.Println(config.AppNameUpperCase + ": " + config.Description) + fmt.Println("-------------------------------------------------") + fmt.Printf("Version : %s\n", slv.Version) + fmt.Printf("Built At : %s\n", buildAt) + fmt.Printf("Git Commit : %s\n", slv.Commit) + fmt.Printf("Web : %s\n", config.Website) + fmt.Printf("Platform : %s\n", runtime.GOOS+"/"+runtime.GOARCH) + fmt.Printf("Go Version : %s\n", runtime.Version()) } func versionCommand() *cobra.Command { diff --git a/const.go b/const.go index 1e39d0e..5c58157 100644 --- a/const.go +++ b/const.go @@ -6,13 +6,10 @@ import ( "savesecrets.org/slv/core/crypto" ) -const ( - // AppName = config.AppName - Prefix = "SLV" -) - var ( Version = "dev" + Commit = "none" + BuildDate = "" secretKey *crypto.SecretKey errEnvironmentAccessNotFound = errors.New("environment doesn't have access. please set the required environment variables") ) diff --git a/core/config/const.go b/core/config/const.go index c2bd8ff..af25306 100644 --- a/core/config/const.go +++ b/core/config/const.go @@ -12,6 +12,14 @@ const ( AppNameLowerCase = "slv" AppNameUpperCase = "SLV" + Description = "Secure Local Vault | Secrets Launch Vehicle" + Website = "https://savesecrets.org/slv" + Art = ` + ____ _ __ __ + / ___|| |\ \ / / + \___ \| | \ \ / / + ___) | |__\ V / + |____/|_____\_/ ` ) var (