Repository navigation
Conversation
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.
"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