(cmd *cobra.Command, args []string)
| 205 | } |
| 206 | |
| 207 | func (c *todoCompleteCommand) run(cmd *cobra.Command, args []string) error { |
| 208 | if err := requireAuth(); err != nil { |
| 209 | return err |
| 210 | } |
| 211 | |
| 212 | id, err := strconv.ParseInt(args[0], 10, 64) |
| 213 | if err != nil { |
| 214 | return output.ErrUsage(fmt.Sprintf("invalid todo ID: %s", args[0])) |
| 215 | } |
| 216 | |
| 217 | ctx := cmd.Context() |
| 218 | result, err := sdk.CalendarTodos().Complete(ctx, id) |
| 219 | if err != nil { |
| 220 | return convertSDKError(err) |
| 221 | } |
| 222 | |
| 223 | if writer.IsStyled() { |
| 224 | fmt.Fprintf(cmd.OutOrStdout(), "Todo completed.%s\n", extractMutationInfoFromResult(result)) |
| 225 | return nil |
| 226 | } |
| 227 | |
| 228 | normalized, nerr := normalizeAny(result) |
| 229 | if nerr != nil { |
| 230 | return writeOK(nil, output.WithSummary("Todo completed")) |
| 231 | } |
| 232 | return writeOK(normalized, output.WithSummary("Todo completed")) |
| 233 | } |
| 234 | |
| 235 | // uncomplete |
| 236 |
nothing calls this directly
no test coverage detected