Skip to content

Commit

Permalink
Merge pull request #181 from essentialkaos/develop
Browse files Browse the repository at this point in the history
Version 8.0.2
  • Loading branch information
andyone authored Dec 25, 2023
2 parents 93b8c56 + 13fb4eb commit b9bebea
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 57 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}

Expand Down Expand Up @@ -78,7 +78,7 @@ jobs:
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: '1.20.x'

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ jobs:
fetch-depth: 2

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: go

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
################################################################################

# This Makefile generated by GoMakeGen 2.2.0 using next command:
# This Makefile generated by GoMakeGen 2.3.0 using next command:
# gomakegen --mod .
#
# More info: https://kaos.sh/gomakegen
Expand All @@ -13,6 +13,7 @@ ifdef VERBOSE ## Print verbose information (Flag)
VERBOSE_FLAG = -v
endif

COMPAT ?= 1.18
MAKEDIR = $(dir $(realpath $(firstword $(MAKEFILE_LIST))))
GITREV ?= $(shell test -s $(MAKEDIR)/.git && git rev-parse --short HEAD)

Expand Down Expand Up @@ -61,7 +62,7 @@ else
endif

ifdef COMPAT ## Compatible Go version (String)
go mod tidy $(VERBOSE_FLAG) -compat=$(COMPAT)
go mod tidy $(VERBOSE_FLAG) -compat=$(COMPAT) -go=$(COMPAT)
else
go mod tidy $(VERBOSE_FLAG)
endif
Expand Down Expand Up @@ -105,6 +106,6 @@ help: ## Show this info
| sed 's/ifdef //' \
| awk 'BEGIN {FS = " .*?## "}; {printf " \033[32m%-14s\033[0m %s\n", $$1, $$2}'
@echo -e ''
@echo -e '\033[90mGenerated by GoMakeGen 2.2.0\033[0m\n'
@echo -e '\033[90mGenerated by GoMakeGen 2.3.0\033[0m\n'

################################################################################
2 changes: 1 addition & 1 deletion action/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func Template(action *recipe.Action) error {
tmplData, err := os.ReadFile(source)

if err != nil {
fmt.Errorf("Can't read template %q: %v", source, err)
return fmt.Errorf("Can't read template %q: %v", source, err)
}

tmpl, err := template.New("").Parse(string(tmplData))
Expand Down
48 changes: 10 additions & 38 deletions cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"github.com/essentialkaos/ek/v12/options"
"github.com/essentialkaos/ek/v12/req"
"github.com/essentialkaos/ek/v12/strutil"
"github.com/essentialkaos/ek/v12/terminal/tty"
"github.com/essentialkaos/ek/v12/usage"
"github.com/essentialkaos/ek/v12/usage/completion/bash"
"github.com/essentialkaos/ek/v12/usage/completion/fish"
Expand All @@ -40,7 +41,7 @@ import (
// Application info
const (
APP = "bibop"
VER = "8.0.1"
VER = "8.0.2"
DESC = "Utility for testing command-line tools"
)

Expand Down Expand Up @@ -101,8 +102,7 @@ var optMap = options.Map{
OPT_GENERATE_MAN: {Type: options.BOOL},
}

var colorTagApp string
var colorTagVer string
var colorTagApp, colorTagVer string
var rawOutput bool

// ////////////////////////////////////////////////////////////////////////////////// //
Expand Down Expand Up @@ -144,23 +144,7 @@ func Run(gitRev string, gomod []byte) {

// preConfigureUI preconfigures UI based on information about user terminal
func preConfigureUI() {
term := os.Getenv("TERM")

fmtc.DisableColors = true

if term != "" {
switch {
case strings.Contains(term, "xterm"),
strings.Contains(term, "color"),
term == "screen":
fmtc.DisableColors = false
}
}

// Check for output redirect using pipes
if fsutil.IsCharacterDevice("/dev/stdin") &&
!fsutil.IsCharacterDevice("/dev/stdout") &&
os.Getenv("FAKETTY") == "" {
if !tty.IsTTY() {
fmtc.DisableColors = true
rawOutput = true
}
Expand All @@ -171,17 +155,13 @@ func preConfigureUI() {
fmtc.DisableColors = false
}

if os.Getenv("NO_COLOR") != "" {
fmtc.DisableColors = true
}

switch {
case fmtc.IsTrueColorSupported():
colorTagApp, colorTagVer = "{#66CC99}", "{#66CC99}"
colorTagApp, colorTagVer = "{*}{#66CC99}", "{#66CC99}"
case fmtc.Is256ColorsSupported():
colorTagApp, colorTagVer = "{#85}", "{#85}"
colorTagApp, colorTagVer = "{*}{#85}", "{#85}"
default:
colorTagApp, colorTagVer = "{c}", "{c}"
colorTagApp, colorTagVer = "{*}{c}", "{c}"
}

fmtutil.SeparatorTitleColorTag = colorTagApp
Expand Down Expand Up @@ -407,15 +387,6 @@ func printError(f string, a ...interface{}) {
}
}

// printError prints warning message to console
func printWarn(f string, a ...interface{}) {
if len(a) == 0 {
fmtc.Fprintln(os.Stderr, "{y}"+f+"{!}")
} else {
fmtc.Fprintf(os.Stderr, "{y}"+f+"{!}\n", a...)
}
}

// printErrorAndExit print error message and exit with exit code 1
func printErrorAndExit(f string, a ...interface{}) {
printError(f, a...)
Expand Down Expand Up @@ -451,7 +422,7 @@ func printMan() {
func genUsage() *usage.Info {
info := usage.NewInfo("", "recipe")

info.AppNameColorTag = "{*}" + colorTagApp
info.AppNameColorTag = colorTagApp

info.AddOption(OPT_DRY_RUN, "Parse and validate recipe")
info.AddOption(OPT_EXTRA, "Number of output lines for failed action {s-}(default: 10){!}", "lines")
Expand Down Expand Up @@ -520,8 +491,9 @@ func genAbout(gitRev string) *usage.About {
Year: 2006,
Owner: "ESSENTIAL KAOS",

AppNameColorTag: "{*}" + colorTagApp,
AppNameColorTag: colorTagApp,
VersionColorTag: colorTagVer,
DescSeparator: "{s}—{!}",

License: "Apache License, Version 2.0 <https://www.apache.org/licenses/LICENSE-2.0>",
BugTracker: "https://github.com/essentialkaos/bibop/issues",
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ require (
github.com/creack/pty v1.1.21
github.com/essentialkaos/check v1.4.0
github.com/essentialkaos/depsy v1.1.0
github.com/essentialkaos/ek/v12 v12.86.0
github.com/essentialkaos/ek/v12 v12.92.0
)

require (
github.com/kr/pretty v0.3.1 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/rogpeppe/go-internal v1.11.0 // indirect
golang.org/x/sys v0.14.0 // indirect
golang.org/x/sys v0.15.0 // indirect
)
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ github.com/essentialkaos/check v1.4.0 h1:kWdFxu9odCxUqo1NNFNJmguGrDHgwi3A8daXX1n
github.com/essentialkaos/check v1.4.0/go.mod h1:LMKPZ2H+9PXe7Y2gEoKyVAwUqXVgx7KtgibfsHJPus0=
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.86.0 h1:9HMUsMsNvkgMH4OpQ0S6zhTphBQMl50MT6DYY0EUWg4=
github.com/essentialkaos/ek/v12 v12.86.0/go.mod h1:NSx0QzX8Fplo21PbGNBkmL1j5pyWVKErTgJeSB1kpdA=
github.com/essentialkaos/ek/v12 v12.92.0 h1:3JIkHWNA6MNkJOfqzMWJ8jN9sRM7nRi7URoFRVFHZzI=
github.com/essentialkaos/ek/v12 v12.92.0/go.mod h1:9efMqo1S8EtYhmeelOSTmMQDGC2vRgPkjkKKfvUD2eU=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
Expand All @@ -17,5 +17,5 @@ github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsK
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M=
github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA=
golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q=
golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc=
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
6 changes: 3 additions & 3 deletions render/renderer_terminal.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"github.com/essentialkaos/ek/v12/fmtc"
"github.com/essentialkaos/ek/v12/fmtutil"
"github.com/essentialkaos/ek/v12/strutil"
"github.com/essentialkaos/ek/v12/terminal/window"
"github.com/essentialkaos/ek/v12/terminal/tty"

"github.com/essentialkaos/bibop/recipe"
)
Expand Down Expand Up @@ -252,7 +252,7 @@ func (rr *TerminalRenderer) renderTmpMessage(f string, a ...interface{}) {
return
}

ww := window.GetWidth()
ww := tty.GetWidth()

if ww <= 0 {
fmtc.TPrintf(f, a...)
Expand Down Expand Up @@ -313,7 +313,7 @@ func (rr *TerminalRenderer) renderCurrentActionProgress() {

// renderMessage prints message limited by window size
func (rr *TerminalRenderer) renderMessage(f string, a ...interface{}) {
ww := window.GetWidth()
ww := tty.GetWidth()

if ww <= 0 {
fmtc.Printf(f, a...)
Expand Down
4 changes: 2 additions & 2 deletions scripts/bibop-massive
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
################################################################################

APP="bibop-massive"
VER="1.12.1"
VER="1.12.2"
DESC="Utility for mass package testing"

################################################################################
Expand Down Expand Up @@ -1076,7 +1076,7 @@ separator() {
# Code: No
# Echo: No
printLegend() {
show "\n${CL_BOLD}Legend:${CL_NORM} ${CL_DARK}${CL_NORM} - skipped ${CL_DARK}|${CL_NORM} ${CL_GREEN}${CL_NORM} - passed ${CL_DARK}|${CL_NORM} ${CL_YELLOW}${CL_NORM} - warning ${CL_DARK}|${CL_NORM} ${CL_RED}${CL_NORM} - error"
show "\n${CL_BOLD}Legend:${CL_NORM} ${CL_DARK}skipped${CL_NORM} ${CL_DARK}|${CL_NORM} ${CL_GREEN}passed${CL_NORM} ${CL_DARK}|${CL_NORM} ${CL_YELLOW}warning${CL_NORM} ${CL_DARK}|${CL_NORM} ${CL_RED}error${CL_NORM}"
}

# Signal trap for INT/TERM/QUIT
Expand Down

0 comments on commit b9bebea

Please sign in to comment.