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

Method run

internal/cmd/timetrack.go:103–128  ·  view source on GitHub ↗
(cmd *cobra.Command, args []string)

Source from the content-addressed store, hash-verified

101 Use: "stop",
102 Short: "Stop time tracking",
103 Long: `Stop the running time track.
104
105--category files the track under a category as it stops it, in the one request, and HEY
106creates the category if it has none by that title. There is no clearing a category this
107way: a blank title leaves the track filed where it was.`,
108 Example: ` hey timetrack stop
109 hey timetrack stop --category "Client work"
110 hey timetrack stop --json`,
111 RunE: timetrackStopCommand.run,
112 }
113
114 timetrackStopCommand.cmd.Flags().StringVar(&timetrackStopCommand.category, "category", "", "Category title to file the stopped track under, created if HEY has none by that title")
115
116 return timetrackStopCommand
117}
118
119func (c *timetrackStopCommand) run(cmd *cobra.Command, args []string) error {
120 if err := requireAuth(); err != nil {
121 return err
122 }
123
124 ctx := cmd.Context()
125 track, err := sdk.TimeTracks().GetOngoing(ctx)
126 if err != nil {
127 return apierr.FromSDK(err)
128 }
129
130 if track == nil {
131 return apierr.ErrNotFound("time track", "active")

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected