func reposToDisplayMeta()

in cli/bpcatalog/render.go [172:205]


func reposToDisplayMeta(r repos) []displayMeta {
	dm := make([]displayMeta, 0, len(r))
	for _, repo := range r {
		displayName := strings.TrimPrefix(repo.GetName(), "terraform-google-")
		displayName = strings.TrimPrefix(displayName, "terraform-")
		d := displayMeta{
			Name:        repo.GetName(),
			DisplayName: displayName,
			URL:         repo.GetHTMLURL(),
			Stars:       strconv.Itoa(repo.GetStargazersCount()),
			CreatedAt:   repo.GetCreatedAt().Format(renderTimeformat),
			Description: repo.GetDescription(),
			Labels:      repo.Topics,
		}

		// gh topics to categories
		parsedCategories := []string{}
		for _, topic := range repo.Topics {
			p, exists := topicToCategory[topic]
			if exists {
				parsedCategories = append(parsedCategories, p)
			}
			if topic == e2eLabel {
				d.IsE2E = true
			}
		}
		if len(parsedCategories) > 0 {
			sort.Strings(parsedCategories)
			d.Categories = strings.Join(parsedCategories, ", ")
		}
		dm = append(dm, d)
	}
	return dm
}