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

Method Stream

internal/display/display.go:187–229  ·  view source on GitHub ↗
(data []View, ch <-chan View)

Source from the content-addressed store, hash-verified

185}
186
187func (r *Renderer) Stream(data []View, ch <-chan View) {
188 w := r.ResultWriter
189
190 displayRow := func(row []string) {
191 fmtStr := strings.Repeat("%s ", len(row))
192 fprintfStr(w, fmtStr, row...)
193 fmt.Fprintln(w)
194 }
195
196 displayView := func(v View) {
197 row := v.AsTableRow()
198 displayRow(row)
199
200 if extras := extractExtras(v); extras != nil {
201 fmt.Fprintln(w)
202 displayRow(extras)
203 fmt.Fprintln(w)
204 }
205 }
206
207 if len(data) > 0 {
208 header := []string{
209 truncate("TYPE", 23),
210 truncate("DESCRIPTION", 54),
211 truncate("DATE", 20),
212 truncate("CONNECTION", 20),
213 truncate("CLIENT", 20),
214 }
215 displayRow(header)
216 }
217
218 for _, v := range data {
219 displayView(v)
220 }
221
222 if ch == nil {
223 return
224 }
225
226 for v := range ch {
227 displayView(v)
228 }
229}
230
231func (r *Renderer) Markdown(document string) {
232 g, _ := glamour.NewTermRenderer(glamour.WithAutoStyle())

Callers 2

LogTailMethod · 0.95
TestStreamFunction · 0.95

Calls 4

fprintfStrFunction · 0.85
extractExtrasFunction · 0.85
truncateFunction · 0.85
AsTableRowMethod · 0.65

Tested by 1

TestStreamFunction · 0.76