diff options
author | MaurĂcio Antunes <mauricio.abreua@gmail.com> | 2022-10-28 21:06:06 -0300 |
---|---|---|
committer | MaurĂcio Antunes <mauricio.abreua@gmail.com> | 2022-10-28 21:06:06 -0300 |
commit | 54319509212db5836edf9e3a1072921ce7c80dbf (patch) | |
tree | fe5d206f99663162df6b950405f1e238e4f3e7e2 /src/cmd/run.go | |
parent | b8faca67ea1a905b48b4a82729987a3965f24013 (diff) |
feat: first exercise running
Diffstat (limited to 'src/cmd/run.go')
-rw-r--r-- | src/cmd/run.go | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/cmd/run.go b/src/cmd/run.go new file mode 100644 index 0000000..876788e --- /dev/null +++ b/src/cmd/run.go @@ -0,0 +1,22 @@ +package cmd + +import ( + "fmt" + + "github.com/mauricioabreu/golings/src/exercises" + "github.com/spf13/cobra" +) + +func init() { + rootCmd.AddCommand(cmdRun) +} + +var cmdRun = &cobra.Command{ + Use: "run [exercise]", + Short: "Run a single exercise", + 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) + }, +} |