Skip to content

TUI: persistent menu with prompt header and ←/Esc navigation#2

Open
Rick-GO wants to merge 1 commit intomasterfrom
feature/persistent-tui
Open

TUI: persistent menu with prompt header and ←/Esc navigation#2
Rick-GO wants to merge 1 commit intomasterfrom
feature/persistent-tui

Conversation

@Rick-GO
Copy link
Copy Markdown
Contributor

@Rick-GO Rick-GO commented May 1, 2026

Summary

Reshapes the go-modules TUI per the apt look-and-feel spec (§ 1–§ 2) and adds a persistent menu loop.

Layout — the menu is now framed by three separator lines:

  GOcontroll Module Manager  v3.0.10
  <module-table>
  ------------------------------------
    Select what you want to do
  ------------------------------------
    scan
  ► update
    overwrite
    check
  ------------------------------------
  ↑/↓ navigate   Enter select   ← back   Esc quit

When the user selects an option, the screen is cleared and redrawn as banner / SEP / <chosen action> / SEP / <action output>.

Persistent loop — actions return to the main menu instead of exiting. Modules are re-scanned at the top of every iteration so the table reflects post-update state. Services (nodered, go-simulink) stay stopped for the duration of the session and are restarted only when the user actually quits.

Key bindings

  • / — navigate options
  • Enter — select
  • / q — back to parent menu (no effect at root)
  • Esc / Ctrl-C / Ctrl-D — close the tool (services restart)

CLI mode — preserved. When called with arguments (go-modules scan, go-modules update all, etc.) the tool still runs once and exits.

Behavioural regression to flag

In CLI mode, update_one_module and update_all_modules previously called err_n_die on the FirmwareCorrupted path (exits -1, services not restarted) and err_n_restart_services on FirmwareUntouched / no-update (exits -1, services restarted). After this refactor both paths print the error and return; the trailing success(...) then restarts services and exits 0. The TUI is the primary use case and it never exited anyway, but if scripts rely on the CLI exit code to detect a failed update this needs an enum-return + match in the CLI dispatch (see comment threads).

CI

The existing build-package.yml only fires on v* tags. Added .github/workflows/ci.yml so this PR builds the aarch64 binary as an artifact on every push — needed for validation since rustc/cargo do not fit on the Moduline L4 rootfs.

Test plan

  • CI green (ci.yml produces go-modules-aarch64 artifact).
  • Install artifact on a Moduline L4 with at least one module fitted; verify the new header layout matches the spec.
  • Selecting scan / update / overwrite / check shows the chosen action between the two SEP bars and returns to the main menu after completion.
  • / q from any sub-menu returns to the parent; from the main menu it just re-renders.
  • Esc from the main menu cleanly closes the tool and restarts nodered / go-simulink.
  • CLI invocation go-modules scan still exits after one scan.

- Add a "Select what you want to do" prompt line above the option list,
  framed by separator lines (per apt look-and-feel spec § 1–§ 2). When an
  option is chosen, the prompt is replaced by the chosen action's name.
- Make the TUI persistent: actions return to the main menu instead of
  exiting. Modules are re-scanned on every iteration.
- Key bindings: ←/q go back one menu, Esc/Ctrl-C/Ctrl-D close the tool.
- Refactor update_one_module / update_all_modules to return normally
  instead of -> !, so the loop can iterate. CLI mode still exits at the
  end of an action.
- Add a CI workflow that builds the aarch64 binary on PRs (the existing
  build-package.yml only fires on v* tags / produces releases).
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.

1 participant