blob: 103ea21cd9a60c3d19c875aadb17d3bb4e4aa0a4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
package cmd
import (
"os"
"github.com/fatih/color"
"github.com/mauricioabreu/golings/src/exercises"
"github.com/mauricioabreu/golings/src/printer"
"github.com/spf13/cobra"
)
func init() {
rootCmd.AddCommand(cmdList)
}
var cmdList = &cobra.Command{
Use: "list",
Short: "List all exercises",
Run: func(cmd *cobra.Command, args []string) {
exs, err := exercises.List()
if err != nil {
color.Red(err.Error())
os.Exit(1)
}
printer.PrintList(os.Stdout, exs)
},
}
|