MCPcopy
hub / github.com/cli/cli / AddTimeField

Method AddTimeField

internal/tableprinter/table_printer.go:26–34  ·  view source on GitHub ↗

AddTimeField in TTY mode displays the fuzzy time difference between now and t. In non-TTY mode it just displays t with the time.RFC3339 format.

(now, t time.Time, c func(string) string)

Source from the content-addressed store, hash-verified

24// AddTimeField in TTY mode displays the fuzzy time difference between now and t.
25// In non-TTY mode it just displays t with the time.RFC3339 format.
26func (tp *TablePrinter) AddTimeField(now, t time.Time, c func(string) string) {
27 var tf string
28 if tp.isTTY {
29 tf = text.FuzzyAgo(now, t)
30 } else {
31 tf = t.Format(time.RFC3339)
32 }
33 tp.AddField(tf, WithColor(c))
34}
35
36var (
37 WithColor = tableprinter.WithColor

Callers 15

listRunFunction · 0.80
printDiscussionsFunction · 0.80
listRunFunction · 0.80
listRunFunction · 0.80
listRunFunction · 0.80
displayResultsFunction · 0.80
displayIssueResultsFunction · 0.80
displayResultsFunction · 0.80
PrintIssuesFunction · 0.80
printTableFunction · 0.80
listRunFunction · 0.80
listRunFunction · 0.80

Calls 1

FuzzyAgoFunction · 0.92

Tested by

no test coverage detected