From c6aa89d7041d64f2e467b6a5a4f505439bf7feeb Mon Sep 17 00:00:00 2001 From: Anton Novojilov Date: Mon, 1 Apr 2024 15:51:25 +0300 Subject: [PATCH] Dependencies update --- cli/cli.go | 47 ++++++++++++++++++++++++++++++++++++++++------- go.mod | 2 +- go.sum | 4 ++-- 3 files changed, 43 insertions(+), 10 deletions(-) diff --git a/cli/cli.go b/cli/cli.go index c68893d..69240bb 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -34,6 +34,7 @@ import ( "github.com/essentialkaos/ek/v12/usage/completion/fish" "github.com/essentialkaos/ek/v12/usage/completion/zsh" "github.com/essentialkaos/ek/v12/usage/man" + "github.com/essentialkaos/ek/v12/usage/update" "github.com/essentialkaos/redis-latency-monitor/stats" ) @@ -97,16 +98,29 @@ var optMap = options.Map{ OPT_GENERATE_MAN: {Type: options.BOOL}, } +// colorTagApp contains color tag for app name +var colorTagApp string + +// colorTagVer contains color tag for app version +var colorTagVer string + // pingCommand is PING command data var pingCommand = []byte("PING\r\n") -var ( - conn net.Conn - host string - timeout time.Duration - outputWriter *bufio.Writer - errorLogged bool -) +// conn is connection to Redis +var conn net.Conn + +// host is Redis host +var host string + +// timeout is connection timeout +var timeout time.Duration + +// outputWriter is buffered output writer +var outputWriter *bufio.Writer + +// errorLogged is error logging flag +var errorLogged bool // ////////////////////////////////////////////////////////////////////////////////// // @@ -161,6 +175,15 @@ func preConfigureUI() { if !tty.IsTTY() { fmtc.DisableColors = true } + + switch { + case fmtc.IsTrueColorSupported(): + colorTagApp, colorTagVer = "{*}{#DC382C}", "{#A32422}" + case fmtc.Is256ColorsSupported(): + colorTagApp, colorTagVer = "{*}{#160}", "{#124}" + default: + colorTagApp, colorTagVer = "{r*}", "{r}" + } } // configureUI configures user interface @@ -567,6 +590,8 @@ func printMan() { func genUsage() *usage.Info { info := usage.NewInfo() + info.AppNameColorTag = colorTagApp + info.AddSpoiler("Utility shows PING command latency or connection latency in milliseconds (one thousandth of a second).") info.AddOption(OPT_HOST, "Server hostname {s-}(127.0.0.1 by default){!}", "ip/host") @@ -604,10 +629,18 @@ func genAbout(gitRev string) *usage.About { Year: 2006, Owner: "ESSENTIAL KAOS", License: "Apache License, Version 2.0 ", + + AppNameColorTag: colorTagApp, + VersionColorTag: colorTagVer, + DescSeparator: "{s}—{!}", } if gitRev != "" { about.Build = "git:" + gitRev + about.UpdateChecker = usage.UpdateChecker{ + "essentialkaos/redis-latency-monitor", + update.GitHubChecker, + } } return about diff --git a/go.mod b/go.mod index 13a9cab..a138448 100644 --- a/go.mod +++ b/go.mod @@ -2,7 +2,7 @@ module github.com/essentialkaos/redis-latency-monitor go 1.18 -require github.com/essentialkaos/ek/v12 v12.113.0 +require github.com/essentialkaos/ek/v12 v12.113.1 require ( github.com/essentialkaos/depsy v1.1.0 // indirect diff --git a/go.sum b/go.sum index 898b4c3..efceef3 100644 --- a/go.sum +++ b/go.sum @@ -1,8 +1,8 @@ github.com/essentialkaos/check v1.4.0 h1:kWdFxu9odCxUqo1NNFNJmguGrDHgwi3A8daXX1nkuKk= github.com/essentialkaos/depsy v1.1.0 h1:U6dp687UkQwXlZU17Hg2KMxbp3nfZAoZ8duaeUFYvJI= github.com/essentialkaos/depsy v1.1.0/go.mod h1:kpiTAV17dyByVnrbNaMcZt2jRwvuXClUYOzpyJQwtG8= -github.com/essentialkaos/ek/v12 v12.113.0 h1:/kfEaqbexLSvscwQfVDusA7IMRIPUNn+Hr/0xhKFNXc= -github.com/essentialkaos/ek/v12 v12.113.0/go.mod h1:SslW97Se34YQKc08Ume2V/8h/HPTgLS1+Iok64cNF/U= +github.com/essentialkaos/ek/v12 v12.113.1 h1:3opV9dwRpIQq1fqg5mkaSEt6ogECL4VLzrH/829qeYg= +github.com/essentialkaos/ek/v12 v12.113.1/go.mod h1:SslW97Se34YQKc08Ume2V/8h/HPTgLS1+Iok64cNF/U= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M=