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)
| 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. |
| 26 | func (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 | |
| 36 | var ( |
| 37 | WithColor = tableprinter.WithColor |
no test coverage detected