PrintLinkTable prints item links in a formatted table.
(links []models.ItemLink)
| 631 | |
| 632 | // PrintLinkTable prints item links in a formatted table. |
| 633 | func PrintLinkTable(links []models.ItemLink) { |
| 634 | if len(links) == 0 { |
| 635 | fmt.Println("No links found.") |
| 636 | return |
| 637 | } |
| 638 | |
| 639 | w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0) |
| 640 | fmt.Fprintf(w, "TYPE\tSOURCE\tTARGET\tCREATED\n") |
| 641 | for _, link := range links { |
| 642 | fmt.Fprintf(w, "%s\t%s\t%s\t%s\n", |
| 643 | link.LinkType, |
| 644 | link.SourceTitle, |
| 645 | link.TargetTitle, |
| 646 | RelativeTime(link.CreatedAt), |
| 647 | ) |
| 648 | } |
| 649 | w.Flush() |
| 650 | } |
| 651 | |
| 652 | // PrintActivityTable prints activity entries in a table. |
| 653 | func PrintActivityTable(activities []models.Activity) { |
nothing calls this directly
no test coverage detected