From f5441eb6cb3a091605f73f9cbc5e0fa26a956244 Mon Sep 17 00:00:00 2001 From: Denis Kirillov Date: Wed, 13 Jul 2022 15:27:05 +0300 Subject: [PATCH] [#578] Unify version output Signed-off-by: Denis Kirillov --- cmd/s3-authmate/main.go | 6 +++++- cmd/s3-gw/app_settings.go | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/cmd/s3-authmate/main.go b/cmd/s3-authmate/main.go index eb3d72c..4fb679a 100644 --- a/cmd/s3-authmate/main.go +++ b/cmd/s3-authmate/main.go @@ -8,6 +8,7 @@ import ( "net/http" "os" "os/signal" + "runtime" "strings" "syscall" "time" @@ -109,12 +110,15 @@ func prepare() (context.Context, *zap.Logger) { func main() { app := &cli.App{ - Name: "NeoFS gate authentication manager", + Name: "NeoFS S3 Authmate", Usage: "Helps manage delegated access via gates to data stored in NeoFS network", Version: version.Version, Flags: appFlags(), Commands: appCommands(), } + cli.VersionPrinter = func(c *cli.Context) { + fmt.Printf("%s\nVersion: %s\nGoVersion: %s\n", c.App.Name, c.App.Version, runtime.Version()) + } viper.AutomaticEnv() viper.SetEnvPrefix("AUTHMATE") diff --git a/cmd/s3-gw/app_settings.go b/cmd/s3-gw/app_settings.go index e30f2aa..af99437 100644 --- a/cmd/s3-gw/app_settings.go +++ b/cmd/s3-gw/app_settings.go @@ -3,6 +3,7 @@ package main import ( "fmt" "os" + "runtime" "sort" "strconv" "strings" @@ -259,7 +260,7 @@ func newSettings() *viper.Viper { os.Exit(0) case versionFlag != nil && *versionFlag: - fmt.Printf("NeoFS S3 gateway %s\n", version.Version) + fmt.Printf("NeoFS S3 Gateway\nVersion: %s\nGoVersion: %s\n", version.Version, runtime.Version()) os.Exit(0) }