diff --git a/cli/cli.go b/cli/cli.go index 47f6b55..4532794 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -27,6 +27,7 @@ import ( "github.com/essentialkaos/ek/v12/strutil" "github.com/essentialkaos/ek/v12/support" "github.com/essentialkaos/ek/v12/support/deps" + "github.com/essentialkaos/ek/v12/terminal" "github.com/essentialkaos/ek/v12/terminal/tty" "github.com/essentialkaos/ek/v12/timeutil" "github.com/essentialkaos/ek/v12/usage" @@ -44,7 +45,7 @@ import ( // App info const ( APP = "Redis Latency Monitor" - VER = "3.2.2" + VER = "3.2.3" DESC = "Tiny Redis client for latency measurement" ) @@ -132,11 +133,9 @@ func Run(gitRev string, gomod []byte) { _, errs := options.Parse(optMap) - if len(errs) != 0 { - for _, err := range errs { - printError(err.Error()) - } - + if !errs.IsEmpty() { + terminal.Error("Options parsing errors:") + terminal.Error(errs.String()) os.Exit(1) } @@ -519,15 +518,10 @@ func flushOutput(interval time.Duration) { // printErrorAndExit print error message and exit from utility func printErrorAndExit(f string, a ...interface{}) { - printError(f, a...) + terminal.Error(f, a...) shutdown(1) } -// printError prints error message to console -func printError(f string, a ...interface{}) { - fmtc.Fprintf(os.Stderr, "{r}"+f+"{!}\n", a...) -} - // shutdown close connection to Redis and exit from utility func shutdown(code int) { if conn != nil { @@ -578,12 +572,7 @@ func printCompletion() int { // printMan prints man page func printMan() { - fmt.Println( - man.Generate( - genUsage(), - genAbout(""), - ), - ) + fmt.Println(man.Generate(genUsage(), genAbout(""))) } // genUsage generates usage info diff --git a/common/redis-latency-monitor.spec b/common/redis-latency-monitor.spec index c83edbd..3422d77 100644 --- a/common/redis-latency-monitor.spec +++ b/common/redis-latency-monitor.spec @@ -6,7 +6,7 @@ Summary: Tiny Redis client for latency measurement Name: redis-latency-monitor -Version: 3.2.2 +Version: 3.2.3 Release: 0%{?dist} Group: Applications/System License: Apache License, Version 2.0 @@ -29,14 +29,17 @@ or connection latency in milliseconds (one thousandth of a second). ################################################################################ %prep -%setup -q -%build +%setup -q if [[ ! -d "%{name}/vendor" ]] ; then - echo "This package requires vendored dependencies" + echo -e "----\nThis package requires vendored dependencies\n----" + exit 1 +elif [[ -f "%{name}/%{name}" ]] ; then + echo -e "----\nSources must not contain precompiled binaries\n----" exit 1 fi +%build pushd %{name} go build %{name}.go cp LICENSE .. @@ -89,6 +92,10 @@ fi ################################################################################ %changelog +* Sun Jun 23 2024 Anton Novojilov - 3.2.3-0 +- Code refactoring +- Dependencies update + * Thu Mar 28 2024 Anton Novojilov - 3.2.2-0 - Improved support information gathering - Code refactoring