aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cmd/run.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/cmd/run.go b/src/cmd/run.go
index 876788e..aeec65d 100644
--- a/src/cmd/run.go
+++ b/src/cmd/run.go
@@ -2,7 +2,9 @@ package cmd
import (
"fmt"
+ "os"
+ "github.com/fatih/color"
"github.com/mauricioabreu/golings/src/exercises"
"github.com/spf13/cobra"
)
@@ -17,6 +19,13 @@ var cmdRun = &cobra.Command{
Args: cobra.MatchAll(cobra.ExactArgs(1), cobra.OnlyValidArgs),
Run: func(cmd *cobra.Command, args []string) {
out, err := exercises.Run(args[0])
- fmt.Println(out, err)
+ fmt.Println(out)
+ if err != nil {
+ color.Red("Your exercise is failing")
+ os.Exit(1)
+ }
+ color.Green("Congratulations!")
+ color.Green("Remove the 'I AM NOT DONE' from the file to keep going")
+ os.Exit(0)
},
}