(cmd *cobra.Command, args []string)
| 299 | } |
| 300 | |
| 301 | func (c *todoDeleteCommand) run(cmd *cobra.Command, args []string) error { |
| 302 | if err := requireAuth(); err != nil { |
| 303 | return err |
| 304 | } |
| 305 | |
| 306 | id, err := strconv.ParseInt(args[0], 10, 64) |
| 307 | if err != nil { |
| 308 | return output.ErrUsage(fmt.Sprintf("invalid todo ID: %s", args[0])) |
| 309 | } |
| 310 | |
| 311 | ctx := cmd.Context() |
| 312 | err = sdk.CalendarTodos().Delete(ctx, id) |
| 313 | if err != nil { |
| 314 | return convertSDKError(err) |
| 315 | } |
| 316 | |
| 317 | if writer.IsStyled() { |
| 318 | fmt.Fprintln(cmd.OutOrStdout(), "Todo deleted.") |
| 319 | return nil |
| 320 | } |
| 321 | |
| 322 | return writeOK(nil, output.WithSummary("Todo deleted")) |
| 323 | } |
nothing calls this directly
no test coverage detected