go-mastodon/cmd/mstdn/cmd_timeline.go

23 lines
479 B
Go
Raw Normal View History

2017-04-15 14:52:11 +02:00
package main
import (
"context"
2017-04-15 14:52:11 +02:00
"github.com/mattn/go-mastodon"
"github.com/urfave/cli"
)
func cmdTimeline(c *cli.Context) error {
client := c.App.Metadata["client"].(*mastodon.Client)
config := c.App.Metadata["config"].(*mastodon.Config)
2017-05-04 17:18:17 +02:00
timeline, _, err := client.GetTimelineHome(context.Background(), nil)
2017-04-15 14:52:11 +02:00
if err != nil {
return err
}
2017-04-19 16:21:19 +02:00
s := newScreen(config)
2017-04-15 14:52:11 +02:00
for i := len(timeline) - 1; i >= 0; i-- {
2017-04-19 16:21:19 +02:00
s.displayStatus(c.App.Writer, timeline[i])
2017-04-15 14:52:11 +02:00
}
return nil
}