22 lines
391 B
Go
22 lines
391 B
Go
package render
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/fatih/color"
|
|
"github.com/rodaine/table"
|
|
"gitnet.fr/deblan/mu-go/internal/fs"
|
|
)
|
|
|
|
func RenderFiles(files fs.Files) {
|
|
tbl := table.New("ID", "Name")
|
|
tbl.WithFirstColumnFormatter(color.New(color.FgCyan).SprintfFunc())
|
|
|
|
size := len(files)
|
|
|
|
for key, file := range files {
|
|
tbl.AddRow(fmt.Sprintf("%3d", size-key), file.Name)
|
|
}
|
|
|
|
tbl.Print()
|
|
}
|