MCPcopy Create free account
hub / github.com/auth0/auth0-cli / typeDesc

Method typeDesc

internal/display/logs.go:146–176  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

144}
145
146func (v *LogView) typeDesc() (typ, desc string) {
147 chunks := strings.Split(v.TypeName(), "(")
148
149 // NOTE(cyx): Some logs don't have a typ at all -- for those we'll
150 // provide some indicator that it's empty so it's not as surprising.
151 typ = chunks[0]
152 if typ == "" {
153 typ = "..."
154 }
155
156 typ = truncate(chunks[0], 23)
157
158 if len(chunks) == 2 {
159 desc = strings.TrimSuffix(chunks[1], ")")
160 }
161
162 desc = fmt.Sprintf("%s %s", desc, auth0.StringValue(v.Description))
163
164 switch v.category() {
165 case logCategorySuccess:
166 typ = ansi.Green(typ)
167 case logCategoryFailure:
168 typ = ansi.BrightRed(typ)
169 case logCategoryWarning:
170 typ = ansi.BrightYellow(typ)
171 default:
172 typ = ansi.Faint(typ)
173 }
174
175 return typ, desc
176}
177
178func (r *Renderer) LogPrompt(logs []*management.Log, currentIndex *int) string {
179 resource := "logs"

Callers 1

AsTableRowMethod · 0.95

Calls 6

categoryMethod · 0.95
GreenFunction · 0.92
BrightRedFunction · 0.92
BrightYellowFunction · 0.92
FaintFunction · 0.92
truncateFunction · 0.85

Tested by

no test coverage detected