2017-04-15 14:52:11 +02:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"github.com/fatih/color"
|
|
|
|
"github.com/mattn/go-mastodon"
|
|
|
|
"github.com/urfave/cli"
|
|
|
|
)
|
|
|
|
|
|
|
|
func cmdTimeline(c *cli.Context) error {
|
|
|
|
client := c.App.Metadata["client"].(*mastodon.Client)
|
|
|
|
timeline, err := client.GetTimelineHome()
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
for i := len(timeline) - 1; i >= 0; i-- {
|
|
|
|
t := timeline[i]
|
|
|
|
color.Set(color.FgHiRed)
|
2017-04-16 16:04:31 +02:00
|
|
|
fmt.Fprintln(c.App.Writer, t.Account.Username)
|
2017-04-15 14:52:11 +02:00
|
|
|
color.Set(color.Reset)
|
2017-04-16 16:04:31 +02:00
|
|
|
fmt.Fprintln(c.App.Writer, textContent(t.Content))
|
2017-04-15 14:52:11 +02:00
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|