add account command

pull/14/head
Yasuhiro Matsumoto 2017-04-15 22:58:46 +09:00
parent 76d34e4b04
commit 07710230d9
2 changed files with 34 additions and 0 deletions

View File

@ -0,0 +1,29 @@
package main
import (
"fmt"
"github.com/mattn/go-mastodon"
"github.com/urfave/cli"
)
func cmdAccount(c *cli.Context) error {
client := c.App.Metadata["client"].(*mastodon.Client)
account, err := client.GetAccountCurrentUser()
if err != nil {
return err
}
fmt.Printf("URI : %v\n", account.Acct)
fmt.Printf("ID : %v\n", account.ID)
fmt.Printf("Username : %v\n", account.Username)
fmt.Printf("Acct : %v\n", account.Acct)
fmt.Printf("DisplayName : %v\n", account.DisplayName)
fmt.Printf("Locked : %v\n", account.Locked)
fmt.Printf("CreatedAt : %v\n", account.CreatedAt.Local())
fmt.Printf("FollowersCount: %v\n", account.FollowersCount)
fmt.Printf("FollowingCount: %v\n", account.FollowingCount)
fmt.Printf("StatusesCount : %v\n", account.StatusesCount)
fmt.Printf("Note : %v\n", account.Note)
fmt.Printf("URL : %v\n", account.URL)
return nil
}

View File

@ -202,6 +202,11 @@ func run() int {
Usage: "show instance information",
Action: cmdInstance,
},
{
Name: "account",
Usage: "show account information",
Action: cmdAccount,
},
}
app.Run(os.Args)
return 0