in cmd/hub/api/template.go [107:160]
func formatTemplateEntity(template *StackTemplate, showSecrets, showGitStatus bool, errors []error) []error {
title := formatTemplateTitle(template)
if template.Description != "" {
title = fmt.Sprintf("%s - %s", title, template.Description)
}
fmt.Printf("\n\t%s\n", title)
if len(template.Tags) > 0 {
fmt.Printf("\t\tTags: %s\n", strings.Join(template.Tags, ", "))
}
fmt.Printf("\t\tStatus: %s\n", template.Status)
if template.Stack != nil && template.Stack.Name != "" {
fmt.Printf("\t\tStack: %s\n", formatStackRef(template.Stack))
}
if template.Component != nil && template.Component.Name != "" {
fmt.Printf("\t\tComponent: %s\n", formatComponentRef(template.Component))
}
if len(template.Verbs) > 0 {
fmt.Printf("\t\tVerbs: %s\n", strings.Join(template.Verbs, ", "))
}
if len(template.ComponentsEnabled) > 0 {
fmt.Printf("\t\tComponents enabled: %s\n", strings.Join(template.ComponentsEnabled, ", "))
}
if len(template.TeamsPermissions) > 0 {
formatted := formatTeams(template.TeamsPermissions)
fmt.Printf("\t\tTeams: %s\n", formatted)
}
if template.GitRemote.Public != "" {
fmt.Printf("\t\tGit: %s\n", template.GitRemote.Public)
if showGitStatus {
g, err := templateGitStatus(template.Id)
if err != nil {
errors = append(errors, err)
} else {
commit := g.Commit
if len(commit) > 7 {
commit = commit[:7]
}
fmt.Printf("\t\t\t%s %s %s %s %s\n", commit, g.Ref, g.Author, g.Date, g.Subject)
}
}
}
if len(template.Parameters) > 0 {
fmt.Print("\t\tParameters:\n")
}
resource := fmt.Sprintf("%s/%s", templatesResource, template.Id)
for _, param := range sortParameters(template.Parameters) {
formatted, err := formatParameter(resource, param, showSecrets)
fmt.Printf("\t\t%s\n", formatted)
if err != nil {
errors = append(errors, err)
}
}
return errors
}