Skip to content

Commit

Permalink
adding large slv ascii graphics for version command
Browse files Browse the repository at this point in the history
  • Loading branch information
shibme committed Feb 27, 2024
1 parent 0a49bd0 commit 5068ad8
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 16 additions & 1 deletion cli/internal/commands/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,29 @@ package commands

import (
"fmt"
"runtime"
"time"

"github.com/spf13/cobra"
"savesecrets.org/slv"
"savesecrets.org/slv/core/config"
)

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 {
Expand Down
7 changes: 2 additions & 5 deletions const.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
)
8 changes: 8 additions & 0 deletions core/config/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ const (

AppNameLowerCase = "slv"
AppNameUpperCase = "SLV"
Description = "Secure Local Vault | Secrets Launch Vehicle"
Website = "https://savesecrets.org/slv"
Art = `
____ _ __ __
/ ___|| |\ \ / /
\___ \| | \ \ / /
___) | |__\ V /
|____/|_____\_/ `
)

var (
Expand Down

0 comments on commit 5068ad8

Please sign in to comment.