aboutsummaryrefslogtreecommitdiffstats
path: root/src/printer/list.go
blob: bd6551312b4bbb19a83ea02c1a5b5f6eea5b2b14 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
package printer

import (
	"io"

	"github.com/jedib0t/go-pretty/v6/table"
	"github.com/mauricioabreu/golings/src/exercises"
)

func PrintList(o io.Writer, exs []exercises.Exercise) {
	t := table.NewWriter()
	t.SetOutputMirror(o)
	t.AppendHeader(table.Row{"Name", "Path"})
	for _, ex := range exs {
		t.AppendRow(table.Row{ex.Name, ex.Path})
	}
	t.Render()
}