small refactoring

pull/5/head
Yasuhiro Matsumoto 2017-04-14 12:34:13 +09:00
parent 15f78b2da3
commit 82b81720bd
1 changed files with 14 additions and 10 deletions

View File

@ -179,6 +179,19 @@ func post(client *mastodon.Client, text string) {
} }
} }
func timeline(client *mastodon.Client) {
timeline, err := client.GetTimelineHome()
if err != nil {
log.Fatal(err)
}
for _, t := range timeline {
color.Set(color.FgHiRed)
fmt.Println(t.Account.Username)
color.Set(color.Reset)
fmt.Println(textContent(t.Content))
}
}
func main() { func main() {
file, config, err := getConfig() file, config, err := getConfig()
if err != nil { if err != nil {
@ -202,14 +215,5 @@ func main() {
return return
} }
timeline, err := client.GetTimelineHome() timeline(client)
if err != nil {
log.Fatal(err)
}
for _, t := range timeline {
color.Set(color.FgHiRed)
fmt.Println(t.Account.Username)
color.Set(color.Reset)
fmt.Println(textContent(t.Content))
}
} }