"github.com/spf13/cobra"
)
+var account mastodon.Account
+
func init() {
accountCmd.AddCommand(getFollowersCmd)
rootCmd.AddCommand(accountCmd)
Use: "followers",
Short: "Get account followers",
Long: "Get a list of followers for the current account.",
- Run: func(cmd *cobra.Command, args []string) {
- var account mastodon.Account
+
+ PreRun: func(cmd *cobra.Command, args []string) {
err := account.VerifyCredentials(host, token)
if err != nil {
panic(err.Error())
}
+ },
+ Run: func(cmd *cobra.Command, args []string) {
followers, err := account.GetFollowers(host, token)
if err != nil {
panic(err.Error())
}
for _, value := range followers {
- fmt.Printf("%s\t%s\n", value.ID, value.UserName)
+ fmt.Printf("%s\t%s\n", value.ID, value.Acct)
}
},
}