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:
parent
03270d3d9e
commit
37d776ac40
408 changed files with 170562 additions and 132 deletions
10
test/cli.go
10
test/cli.go
|
@ -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"))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue