func()

in cli/models/catalog.go [116:168]


func (summary *CatalogEntitySummary) displayAsTable() {

	table := createTableWithIdentityDetails(summary.IdentityDetails)
	if summary.Deprecated {
		table.Add("Deprecated:", "true")
	}
	table.Add("Java Type:", summary.JavaType)
	table.Add("Icon URL:", summary.IconUrl)

	for c, conf := range summary.Config {
		if c == 0 {
			table.Add("", "") // helps distinguish entries from one another
			table.Add("Config:", "")
		}
		table.Add("Name:", conf.Name)
		table.Add("Type:", conf.Type)
		table.Add("Description:", conf.Description)
		table.Add("Default Value:", fmt.Sprintf("%v", conf.DefaultValue))
		table.Add("Reconfigurable:", strconv.FormatBool(conf.Reconfigurable))
		table.Add("Label:", conf.Label)
		table.Add("Priority:", strconv.FormatFloat(conf.Priority, 'f', -1, 64))
		table.Add("Pinned:", strconv.FormatBool(conf.Pinned))

		if len(conf.PossibleValues) > 0 {
			var values bytes.Buffer
			for i, pv := range conf.PossibleValues {
				if i > 0 {
					values.WriteString(", ")
				}
				values.WriteString(pv["value"])
				if pv["value"] != pv["description"] {
					values.WriteString(" (" + pv["description"] + ")")
				}
			}
			table.Add("Possible Values:", values.String())
		}
		table.Add("", "") // helps distinguish entries from one another
	}

	for t, tag := range summary.Tags {
		if t == 0 {
			table.Add("", "") // helps distinguish entries from one another
			table.Add("Tags:", "")
		}
		if asJson, erj := json.Marshal(tag); nil == erj {
			table.Add("tag:", string(asJson))
		} else {
			table.Add("tag:", fmt.Sprintf("%v", tag))
		}
	}

	table.Print()
}