go-mastodon/cmd/mstdn/cmd_account.go

31 lines
1.1 KiB
Go
Raw Normal View History

2017-04-15 15:58:46 +02:00
package main
import (
"context"
2017-04-15 15:58:46 +02:00
"fmt"
"github.com/mattn/go-mastodon"
2022-11-27 05:24:42 +01:00
"github.com/urfave/cli/v2"
2017-04-15 15:58:46 +02:00
)
func cmdAccount(c *cli.Context) error {
client := c.App.Metadata["client"].(*mastodon.Client)
account, err := client.GetAccountCurrentUser(context.Background())
2017-04-15 15:58:46 +02:00
if err != nil {
return err
}
2017-04-16 16:04:31 +02:00
fmt.Fprintf(c.App.Writer, "URI : %v\n", account.Acct)
fmt.Fprintf(c.App.Writer, "ID : %v\n", account.ID)
fmt.Fprintf(c.App.Writer, "Username : %v\n", account.Username)
fmt.Fprintf(c.App.Writer, "Acct : %v\n", account.Acct)
fmt.Fprintf(c.App.Writer, "DisplayName : %v\n", account.DisplayName)
fmt.Fprintf(c.App.Writer, "Locked : %v\n", account.Locked)
fmt.Fprintf(c.App.Writer, "CreatedAt : %v\n", account.CreatedAt.Local())
fmt.Fprintf(c.App.Writer, "FollowersCount: %v\n", account.FollowersCount)
fmt.Fprintf(c.App.Writer, "FollowingCount: %v\n", account.FollowingCount)
fmt.Fprintf(c.App.Writer, "StatusesCount : %v\n", account.StatusesCount)
2017-04-25 08:33:55 +02:00
fmt.Fprintf(c.App.Writer, "Note : %v\n", textContent(account.Note))
2017-04-16 16:04:31 +02:00
fmt.Fprintf(c.App.Writer, "URL : %v\n", account.URL)
2017-04-15 15:58:46 +02:00
return nil
}