Skip to content

Add check subcommand for scripting use#59

Draft
justincampbell wants to merge 2 commits intomainfrom
add-check-command
Draft

Add check subcommand for scripting use#59
justincampbell wants to merge 2 commits intomainfrom
add-check-command

Conversation

@justincampbell
Copy link
Copy Markdown
Member

Summary

Adds a check subcommand 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/--quiet flag is accepted without error

Copilot AI review requested due to automatic review settings March 18, 2026 12:41
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 check subcommand that exits 0 when an active Pomodoro is detected, otherwise exits 1
  • Adds a no-op -q/--quiet flag 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
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants