MCPcopy Create free account
hub / github.com/basecamp/hey-cli / run

Method run

internal/cmd/todo.go:207–233  ·  view source on GitHub ↗
(cmd *cobra.Command, args []string)

Source from the content-addressed store, hash-verified

205}
206
207func (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

Callers

nothing calls this directly

Calls 7

WithSummaryFunction · 0.92
requireAuthFunction · 0.85
convertSDKErrorFunction · 0.85
normalizeAnyFunction · 0.85
writeOKFunction · 0.85
IsStyledMethod · 0.80

Tested by

no test coverage detected