镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Share the menu setup and input sends in the settings CLI - #155

Open
FrogAi wants to merge 1 commit into
pfeiferj:mainfrom
FrogAi:share-cli-menu-helpers
Open

FrogAi wants to merge 1 commit into
pfeiferj:mainfrom
FrogAi:share-cli-menu-helpers

Conversation

@FrogAi

@FrogAi FrogAi commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

"cli/settings.go" sets up each menu in two places: once when you pick it from another menu, and again in "restoreAfterInput" when you come back from editing a setting. The Subscribers menu had to be added to both. This replaces "restoreAfterInput" with one "showMenu(state)" that both paths use.

It also adds a small "sendInput" for the three places that send an input with only its type set, which are load defaults, load recommended and save.

It's 23 fewer lines, and the menus behave the same.

Audit report

Why nothing changes

Picking a menu already sets "m.state" to the item's state before the switch, so "showMenu(m.state)" sets the same title, items and selection those cases did. Coming back from an input calls "showMenu(m.returnAfterInput)", which matches "restoreAfterInput" for every state it can be: the settings menu, a personality's settings and Subscribers. Anything else still falls back to the settings menu. "showMenu" also covers the Personalities menu, but nothing returns there after an input, since all of its items open a personality's settings. The personality title is now built from "selectedPersonality" in both paths, which gives the same text "it.title" did for Relaxed, Standard and Aggressive.

Testing

  • A probe test (not committed) walked the menus with Enter through Personalities, Standard, back, Aggressive, back, back to settings, Subscriber Settings, back, Personalities and Relaxed. It then came back from an input to the settings menu, a personality's settings and Subscribers. Every state, title, item count and selection matched main.
  • "sendInput" is the same three lines that were there, but I didn't run it end to end, since publishing needs msgq.
  • "go build ./...", "go vet ./..." and "go test ./..." pass in "golang:1.26.2-bookworm", and gofumpt has no changes for "cli/settings.go".

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