--- /dev/null
+package tooter
+
+import (
+ "fmt"
+
+ "git.vexingworkshop.com/signal9/dead-tooter/pkg/mastodon"
+ "github.com/spf13/cobra"
+)
+
+func init() {
+ accountCmd.AddCommand(getFollowersCmd)
+ rootCmd.AddCommand(accountCmd)
+}
+
+var accountCmd = &cobra.Command{
+ Use: "account",
+ Short: "Account commands",
+ Long: "Commands related to the logged in Mastodon account.",
+ Run: func(cmd *cobra.Command, args []string) {
+ },
+}
+
+var getFollowersCmd = &cobra.Command{
+ 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
+ err := account.VerifyCredentials(host, token)
+ if err != nil {
+ panic(err.Error())
+ }
+
+ 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)
+ }
+ },
+}
"github.com/spf13/cobra"
)
-var host string
-
func init() {
- loginCmd.Flags().StringVarP(&host,
- "host", "H", "", "Mastodon host where your account lives.")
- loginCmd.MarkFlagRequired("host")
-
rootCmd.AddCommand(loginCmd)
}
"github.com/spf13/cobra"
)
+var host string
var token mastodon.Token
+func init() {
+ rootCmd.PersistentFlags().StringVarP(&host,
+ "host", "H", "", "Mastodon host where your account lives.")
+ rootCmd.MarkFlagRequired("host")
+}
+
var rootCmd = &cobra.Command{
Use: "dead-tooter",
Short: "A CLI for Mastodon hate scripts",
},
}
+// Execute base command.
func Execute() {
if err := rootCmd.Execute(); err != nil {
fmt.Println(err)