aboutsummaryrefslogtreecommitdiffstats
path: root/src/cmd/run.go
blob: 876788e1634fa5ac0f12008d1815e1a4bcc39eed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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)
	},
}