diff options
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) + }, +} |