cli: show items always in the same way

This commit is contained in:
Peter Stuifzand 2018-05-12 14:08:40 +02:00
parent eba2afc746
commit ada6c45a0a

View File

@ -147,12 +147,7 @@ func performCommands(sub microsub.Microsub, commands []string) {
timeline := sub.TimelineGet("", "", channel)
for _, item := range timeline.Items {
fmt.Println("--------------------------")
if item.Name == "" && item.Content != nil {
fmt.Println(item.Content.HTML)
} else {
fmt.Println(item.Name)
}
showItem(&item)
}
}
@ -170,12 +165,7 @@ func performCommands(sub microsub.Microsub, commands []string) {
timeline := sub.PreviewURL(url)
for _, item := range timeline.Items {
fmt.Println("--------------------------")
if item.Name == "" && item.Content != nil {
fmt.Println(item.Content.HTML)
} else {
fmt.Println(item.Name)
}
showItem(&item)
}
}
@ -199,3 +189,13 @@ func performCommands(sub microsub.Microsub, commands []string) {
sub.UnfollowURL(uid, url)
}
}
func showItem(item *microsub.Item) {
fmt.Printf("------- %s\n", item.Published)
if item.Name == "" && item.Content != nil {
fmt.Println(item.Content.HTML)
} else {
fmt.Println(item.Name)
}
fmt.Println(item.URL)
}