github.com/taubyte/tau-cli@v0.1.13-0.20240326000942-487f0d57edfc/table/website/list.go (about) 1 package websiteTable 2 3 import ( 4 "os" 5 6 "github.com/jedib0t/go-pretty/v6/table" 7 structureSpec "github.com/taubyte/go-specs/structure" 8 repositoryLib "github.com/taubyte/tau-cli/lib/repository" 9 ) 10 11 func List(libraries []*structureSpec.Website) { 12 t := table.NewWriter() 13 t.SetOutputMirror(os.Stdout) 14 t.SetAllowedRowLength(79) 15 16 t.AppendHeader(table.Row{"ID", "Name\nRepository"}) 17 for _, library := range libraries { 18 id := library.Id 19 if len(library.Id) >= 20 { 20 id = id[:6] + "..." + id[len(id)-6:] 21 } 22 23 t.AppendRow(table.Row{id, library.Name}) 24 t.AppendRow(table.Row{"", repositoryLib.GetRepositoryUrl(library.Provider, library.RepoName)}) 25 t.AppendSeparator() 26 } 27 t.SetStyle(table.StyleLight) 28 t.Render() 29 }