Skip to content

Restore enable/disable cli arguments - #462

Open
TirupMehta wants to merge 1 commit into
tom-james-watson:masterfrom
TirupMehta:fix/cli-enable-disable-args
Open

Restore enable/disable cli arguments#462
TirupMehta wants to merge 1 commit into
tom-james-watson:masterfrom
TirupMehta:fix/cli-enable-disable-args

Conversation

@TirupMehta

Copy link
Copy Markdown

Commit 48f2a6f ("Fix launching settings when opening second instance") accidentally removed the enable/disable command-line argument handling that was introduced in dc5fdba (which fixed #24 and #25). Since then, running breaktimer enable or breaktimer disable - which is still documented in the README - merely opened the settings window without toggling breaks.

This restores the behaviour:

  • The second-instance handler now parses the incoming command line for enable/disable and applies it; otherwise it opens the settings window as before.
  • Parsing also happens on fresh launch via process.argv, so the commands work even when no instance is already running.
  • enable mirrors the tray menu's Enable action: it clears any pending timed disable (disableEndTime) before re-enabling.

Implementation notes:

  • New app/main/lib/cli.ts keeps argument parsing pure and testable.
  • 12 unit tests added in app/main/lib/cli.test.ts, following the existing vitest mock-harness patterns used by breaks.test.ts.

All checks pass locally: npm test (20/20), npm run lint, npm run typecheck, npm run format-check and npm run build-main.

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.
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.

No settings GUI on elementary os (built on ubuntu 18.04)

1 participant