From 542ac41c9b40730f301c009cdbc9225d42486dca Mon Sep 17 00:00:00 2001 From: MaurĂ­cio Antunes Date: Thu, 17 Nov 2022 20:01:10 -0300 Subject: feat: exit with a different message for exercises not found --- golings/cmd/run.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/golings/cmd/run.go b/golings/cmd/run.go index 0278795..ff3fa70 100644 --- a/golings/cmd/run.go +++ b/golings/cmd/run.go @@ -1,6 +1,7 @@ package cmd import ( + "errors" "os" "github.com/fatih/color" @@ -14,7 +15,10 @@ var cmdRun = &cobra.Command{ Args: cobra.MatchAll(cobra.ExactArgs(1), cobra.OnlyValidArgs), Run: func(cmd *cobra.Command, args []string) { result, err := exercises.Run(args[0], "info.toml") - if err != nil { + if errors.Is(err, exercises.ErrExerciseNotFound) { + color.White("No exercise found for '%s'", args[0]) + os.Exit(1) + } else if err != nil { color.Cyan("Failed to compile the exercise %s\n\n", result.Exercise.Path) color.White("Check the output below: \n\n") color.Red(result.Err) -- cgit v1.2.3-70-g09d2