Add author/homepage/license to version + banner; date format fixes
- globals.go: add Homepage and License constants.
- version command: show author, homepage, license, build date.
- Startup banner reformatted to:
vaultik X by Author (commit Y, built on Z) starting up at T.
https://sneak.berlin/go/vaultik
- Commit date now formatted as YYYY-MM-DD (called "build date" in
user-facing output, since the binary was at least compiled once on
the date of commit). Makefile/Dockerfile use git --format=%cs.
goreleaser slices its RFC3339 .CommitDate template var to 10 chars.
This commit is contained in:
@@ -46,9 +46,11 @@ func setupGlobals(lc fx.Lifecycle, g *globals.Globals, v *vaultik.Vaultik, opts
|
||||
// user-facing output is suppressed.
|
||||
v.UI = ui.NewWithColor(io.Discard, false)
|
||||
} else {
|
||||
v.UI.Banner("%s %s (commit %s, %s) invoked at %s by %s",
|
||||
g.Appname, g.Version, g.ShortCommit(), g.CommitDate,
|
||||
g.StartTime.Format(time.RFC3339), globals.Author)
|
||||
v.UI.Banner("%s %s by %s (commit %s, built on %s) starting up at %s.",
|
||||
g.Appname, g.Version, globals.Author,
|
||||
g.ShortCommit(), g.CommitDate,
|
||||
g.StartTime.Format(time.RFC3339))
|
||||
v.UI.Banner("%s", globals.Homepage)
|
||||
}
|
||||
return nil
|
||||
},
|
||||
|
||||
@@ -17,9 +17,13 @@ func NewVersionCommand() *cobra.Command {
|
||||
Args: cobra.NoArgs,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
fmt.Printf("vaultik %s\n", globals.Version)
|
||||
fmt.Printf(" commit: %s\n", globals.Commit)
|
||||
fmt.Printf(" go: %s\n", runtime.Version())
|
||||
fmt.Printf(" os/arch: %s/%s\n", runtime.GOOS, runtime.GOARCH)
|
||||
fmt.Printf(" commit: %s\n", globals.Commit)
|
||||
fmt.Printf(" build date: %s\n", globals.CommitDate)
|
||||
fmt.Printf(" go: %s\n", runtime.Version())
|
||||
fmt.Printf(" os/arch: %s/%s\n", runtime.GOOS, runtime.GOARCH)
|
||||
fmt.Printf(" author: %s\n", globals.Author)
|
||||
fmt.Printf(" homepage: %s\n", globals.Homepage)
|
||||
fmt.Printf(" license: %s\n", globals.License)
|
||||
if globals.Version == "dev" {
|
||||
fmt.Println()
|
||||
fmt.Println("This is a development build (no version information embedded).")
|
||||
|
||||
Reference in New Issue
Block a user