Skip to content

Add Update as a conditional 6th option in the interactive menu#540

Closed
xde013 wants to merge 2 commits intotw93:mainfrom
xde013:feat/update-menu-option
Closed

Add Update as a conditional 6th option in the interactive menu#540
xde013 wants to merge 2 commits intotw93:mainfrom
xde013:feat/update-menu-option

Conversation

@xde013
Copy link

@xde013 xde013 commented Mar 5, 2026

Currently, updating Mole requires knowing and typing mo update each time...
Now when a new version is detected (via the existing update_message cache), a numbered Update entry appears as option 6 in the mo interactive menu.

Changes:

  • show_main_menu: renders option 6 only when MAIN_MENU_SHOW_UPDATE is true
  • interactive_main_menu: sets MAIN_MENU_SHOW_UPDATE from the existing update_message cache, keeping it as the single source of truth
  • Arrow key DOWN bound is capped at 5 or 6 depending on the flag
  • ENTER case 6 and CHAR:6 shortcut both guard on MAIN_MENU_SHOW_UPDATE -> pressing 6 when no update is available is a no-op, consistent with the hidden option
  • tests/completion.bats: adds update and update:Update to latest version assertions to the bash and zsh completion tests

xde013 added 2 commits March 5, 2026 14:39
Shows a numbered Update entry in the main menu only when a new version
is available (driven by the existing update_message cache), with full
arrow-key navigation, Enter, and 6 shortcut support. Also adds update
command coverage to the bash and zsh completion tests.
Added a condition to check if the update option should be displayed in the interactive main menu, improving user experience by preventing unnecessary navigation when updates are not available.
tw93 added a commit that referenced this pull request Mar 5, 2026
@tw93
Copy link
Owner

tw93 commented Mar 5, 2026

@xde013 Thanks a lot for the contribution and for putting this together.

I didn’t merge #540 directly, but I applied the underlying fix on main and linked it as a follow-up to #540.

The main reason is that the PR included more than this specific menu behavior, and the update action could still be triggered through the U shortcut even when the entry was hidden. That behavior is now fixed on main, and I also added test coverage for both the hidden and visible cases.

So there’s no need to merge #540 for this specific change anymore, but I really appreciate the work here.

@tw93 tw93 closed this Mar 5, 2026
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