separate command
This commit is contained in:
parent
094a888b1d
commit
209a15a4d7
4 changed files with 100 additions and 76 deletions
25
cmd/mstdn/cmd_timeline.go
Normal file
25
cmd/mstdn/cmd_timeline.go
Normal file
|
@ -0,0 +1,25 @@
|
|||
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)
|
||||
fmt.Println(t.Account.Username)
|
||||
color.Set(color.Reset)
|
||||
fmt.Println(textContent(t.Content))
|
||||
}
|
||||
return nil
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue