Skip to content

Commit

Permalink
Fix bug with printing error and warning messages with fmt verbs
Browse files Browse the repository at this point in the history
  • Loading branch information
andyone committed Nov 15, 2021
1 parent 5e17bb9 commit 8570621
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import (
// Application info
const (
APP = "bibop"
VER = "4.8.0"
VER = "4.8.1"
DESC = "Utility for testing command-line tools"
)

Expand Down Expand Up @@ -312,12 +312,20 @@ func getRenderer() render.Renderer {

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

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

// printErrorAndExit print error mesage and exit with exit code 1
Expand Down

0 comments on commit 8570621

Please sign in to comment.