Files
yutu/cmd/caption/delete.go
T

45 lines
1.0 KiB
Go

package caption
import (
"github.com/eat-pray-ai/yutu/pkg/caption"
"github.com/spf13/cobra"
)
const (
deleteShort = "Delete captions"
deleteLong = "Delete captions of a video by ids"
deleteIdsUsage = "IDs of the captions to delete"
)
var deleteCmd = &cobra.Command{
Use: "delete",
Short: deleteShort,
Long: deleteLong,
Run: func(cmd *cobra.Command, args []string) {
c := caption.NewCation(
caption.WithIDs(ids),
caption.WithOnBehalfOf(onBehalfOf),
caption.WithOnBehalfOfContentOwner(onBehalfOfContentOwner),
caption.WithService(nil),
)
err := c.Delete(cmd.OutOrStdout())
if err != nil {
_ = cmd.Help()
cmd.PrintErrf("Error: %v\n", err)
}
},
}
func init() {
captionCmd.AddCommand(deleteCmd)
deleteCmd.Flags().StringSliceVarP(&ids, "ids", "i", []string{}, deleteIdsUsage)
deleteCmd.Flags().StringVarP(&onBehalfOf, "onBehalfOf", "b", "", "")
deleteCmd.Flags().StringVarP(
&onBehalfOfContentOwner, "onBehalfOfContentOwner", "B", "", "",
)
_ = deleteCmd.MarkFlagRequired("ids")
}