Draft
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new pomodoro check subcommand intended for script/hook usage by indicating whether a Pomodoro is currently active via process exit code (and no output).
Changes:
- Introduces
checksubcommand that exits 0 when an active Pomodoro is detected, otherwise exits 1 - Adds a no-op
-q/--quietflag for compatibility with common scripting idioms
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| func checkCmd(cmd *cobra.Command, args []string) error { | ||
| s, err := client.CurrentState() | ||
| if err != nil { | ||
| return err |
cmd/check.go
Outdated
Comment on lines
+27
to
+33
| if s.Pomodoro.IsActive() { | ||
| return nil | ||
| } | ||
|
|
||
| os.Exit(1) | ||
| return nil | ||
| } |
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.
Summary
Adds a
checksubcommand that exits 0 if a pomodoro is currently active and has time remaining, or exits 1 otherwise (expired, on break, or no session). No output is produced, making it suitable for use in scripts and hooks.Test plan
pomodoro check && echo "working" || echo "on break"prints the correct branch when a pomodoro is/isn't running-q/--quietflag is accepted without error