go-mastodon/cmd/mstdn/cmd_delete.go

24 lines
440 B
Go
Raw Normal View History

2017-04-19 19:04:20 +02:00
package main
import (
"context"
"errors"
"github.com/mattn/go-mastodon"
2022-11-27 05:24:42 +01:00
"github.com/urfave/cli/v2"
2017-04-19 19:04:20 +02:00
)
func cmdDelete(c *cli.Context) error {
client := c.App.Metadata["client"].(*mastodon.Client)
if !c.Args().Present() {
return errors.New("arguments required")
}
for i := 0; i < c.NArg(); i++ {
2017-10-25 08:23:53 +02:00
err := client.DeleteStatus(context.Background(), mastodon.ID(c.Args().Get(i)))
2017-04-19 19:04:20 +02:00
if err != nil {
return err
}
}
return nil
}