go-mastodon/cmd/mstdn/cmd_delete.go
Yasuhiro Matsumoto a7e10ddba4 fix ID
2017-10-25 15:23:53 +09:00

24 lines
437 B
Go

package main
import (
"context"
"errors"
"github.com/mattn/go-mastodon"
"github.com/urfave/cli"
)
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++ {
err := client.DeleteStatus(context.Background(), mastodon.ID(c.Args().Get(i)))
if err != nil {
return err
}
}
return nil
}