1
0
Fork 0
mirror of https://github.com/vbatts/go-mtree.git synced 2025-06-29 04:58:28 +00:00

cli.test: colorize the success/failure

updating and adding vendored source to do it

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
Vincent Batts 2018-08-19 18:34:53 -04:00
parent 03270d3d9e
commit 37d776ac40
Signed by: vbatts
GPG key ID: 10937E57733F1362
408 changed files with 170562 additions and 132 deletions

View file

@ -7,10 +7,14 @@ import (
"fmt"
"os"
"os/exec"
"github.com/fatih/color"
)
func main() {
flag.Parse()
green := color.New(color.FgGreen).SprintFunc()
red := color.New(color.FgRed).SprintFunc()
failed := 0
for _, arg := range flag.Args() {
@ -22,12 +26,12 @@ func main() {
cmd.Stdout = os.Stdout
if err := cmd.Run(); err != nil {
failed++
fmt.Fprintf(os.Stderr, "FAILED: %s\n", arg)
fmt.Fprintf(os.Stderr, red("FAILED: %s\n"), arg)
}
}
if failed > 0 {
fmt.Fprintf(os.Stderr, "%d FAILED tests\n", failed)
fmt.Fprintf(os.Stderr, red("%d FAILED tests\n"), failed)
os.Exit(1)
}
fmt.Fprintf(os.Stdout, "SUCCESS: no cli tests failed\n")
fmt.Fprintf(os.Stdout, green("SUCCESS: no cli tests failed\n"))
}