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

Method run

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

Source from the content-addressed store, hash-verified

147 return writeMutation(cmd, summary, nil)
148}
149
150// current
151
152type timetrackCurrentCommand struct {
153 cmd *cobra.Command
154}
155
156func newTimetrackCurrentCommand() *timetrackCurrentCommand {
157 timetrackCurrentCommand := &timetrackCurrentCommand{}
158 timetrackCurrentCommand.cmd = &cobra.Command{
159 Use: "current",
160 Short: "Show current time tracking status",
161 Example: ` hey timetrack current
162 hey timetrack current --json`,
163 RunE: timetrackCurrentCommand.run,
164 }
165
166 return timetrackCurrentCommand
167}
168
169func (c *timetrackCurrentCommand) run(cmd *cobra.Command, args []string) error {
170 if err := requireAuth(); err != nil {
171 return err
172 }
173
174 ctx := cmd.Context()
175 track, err := sdk.TimeTracks().GetOngoing(ctx)
176 if err != nil {
177 return apierr.FromSDK(err)
178 }
179
180 if writer.IsStyled() {
181 w := cmd.OutOrStdout()
182 if track == nil {
183 fmt.Fprintln(w, "No active time track.")
184 return nil
185 }

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected