Merged
Conversation
Co-authored-by: rustyeddy <2903425+rustyeddy@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add CLI command for timers in ottoctl
Add timers CLI command to ottoctl
Jan 4, 2026
rustyeddy
approved these changes
Jan 4, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a new timers command to the ottoctl CLI tool that queries timer/ticker information from the Otto server's existing /api/timers endpoint, following established patterns from the stats and stations commands.
- Implements
GetTimers()client method to fetch timer information from the server - Adds
timerscommand with JSON output formatting - Includes comprehensive test coverage for success, empty, and error cases
- Fixes Makefile flag ordering and adds binary to .gitignore
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| cmd/ottoctl/cmd_timers.go | New Cobra command implementation for querying timer information from the server |
| client/client.go | Adds GetTimers() method to fetch []utils.TickerInfo from /api/timers endpoint |
| cmd/ottoctl/cmd_root.go | Registers timersCmd with the root command |
| cmd/ottoctl/cmd_timers_test.go | Test coverage for success, empty response, and error scenarios |
| cmd/ottoctl/testdata/timers.json | Test fixture data with sample timer information |
| cmd/ottoctl/ottoctl/Makefile | Corrects go build flag order (-o before target path) |
| .gitignore | Adds cmd/ottoctl/ottoctl/ottoctl binary to exclusion list |
cmd/ottoctl/cmd_timers.go
Outdated
| // Pretty print the JSON response | ||
| jsonBytes, err := json.MarshalIndent(timers, "", " ") | ||
| if err != nil { | ||
| fmt.Fprintf(errOutput, "%s", err) |
There was a problem hiding this comment.
The error message formatting is inconsistent with the pattern on line 30. The error should include a newline character for consistency. Consider changing fmt.Fprintf(errOutput, "%s", err) to fmt.Fprintf(errOutput, "%v\n", err) or fmt.Fprintf(errOutput, "Error marshaling JSON: %v\n", err) to match the format used on line 30.
Suggested change
| fmt.Fprintf(errOutput, "%s", err) | |
| fmt.Fprintf(errOutput, "%v\n", err) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements a new
timerscommand for the ottoctl CLI to query timer/ticker information from the Otto server's existing/api/timersendpoint.Changes
statsandstationscommandsGetTimers()method to fetch[]utils.TickerInfofrom/api/timerstimersCmdwith root commandUsage
Additional Fixes
-obefore target)cmd/ottoctl/ottoctl/ottoctlto exclude binary from version controlOriginal prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.