Skip to content

Commit

Permalink
Dependencies update
Browse files Browse the repository at this point in the history
  • Loading branch information
andyone committed Apr 1, 2024
1 parent e69efbf commit c6aa89d
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 10 deletions.
47 changes: 40 additions & 7 deletions cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -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

// ////////////////////////////////////////////////////////////////////////////////// //

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -604,10 +629,18 @@ func genAbout(gitRev string) *usage.About {
Year: 2006,
Owner: "ESSENTIAL KAOS",
License: "Apache License, Version 2.0 <https://www.apache.org/licenses/LICENSE-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
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -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=
Expand Down

0 comments on commit c6aa89d

Please sign in to comment.