Restore enable/disable cli arguments - #462
Open
TirupMehta wants to merge 1 commit into
Open
Conversation
Commit 48f2a6f accidentally removed the enable/disable command-line argument handling introduced in dc5fdba, so the documented 'breaktimer enable'/'breaktimer disable' commands stopped working and just opened the settings window instead. Parse incoming second-instance command lines (and process.argv on fresh launch) for enable/disable actions. Enabling also clears any pending timed disable, mirroring the tray Enable action.
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.
Commit 48f2a6f ("Fix launching settings when opening second instance") accidentally removed the
enable/disablecommand-line argument handling that was introduced in dc5fdba (which fixed #24 and #25). Since then, runningbreaktimer enableorbreaktimer disable- which is still documented in the README - merely opened the settings window without toggling breaks.This restores the behaviour:
second-instancehandler now parses the incoming command line forenable/disableand applies it; otherwise it opens the settings window as before.process.argv, so the commands work even when no instance is already running.enablemirrors the tray menu's Enable action: it clears any pending timed disable (disableEndTime) before re-enabling.Implementation notes:
app/main/lib/cli.tskeeps argument parsing pure and testable.app/main/lib/cli.test.ts, following the existing vitest mock-harness patterns used bybreaks.test.ts.All checks pass locally:
npm test(20/20),npm run lint,npm run typecheck,npm run format-checkandnpm run build-main.