fix(cli): persist /theme selection to user config so it survives restart#3043
Merged
Conversation
The /theme command (e.g. /theme light) only modified the runtime activeCLITheme variable and refreshed the UI, but never wrote the choice to ~/.config/reasonix/config.toml. On next startup the config loader read the old value and the theme was lost. Add a persistTheme helper that writes theme and theme_style to the user config file, called after every successful /theme switch. Follow the same pattern used by /effort and /language. Fixes the issue where theme changes revert on restart.
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.
Problem
The
/themecommand (e.g./theme light) only modified the runtimeactiveCLIThemevariable and refreshed the UI, but never wrote the choice to~/.config/reasonix/config.toml. On next startup the config loader read the old value and the theme was lost — the user's theme preference reverted to the default.Fix
Added a
persistThememethod called after every successful/themeswitch, following the same pattern used by/effortand/language(which already persist to config).~/.config/reasonix/config.toml/theme light//theme dark//theme autotheme = "..."+ currenttheme_style/theme aurora(any style name)theme = "dark"/"light"+theme_style = "aurora"Verification
go build ./...— passesgo test ./internal/cli/ -run Theme— all theme tests passgo test ./internal/config/ -run TestRenderTOML— passes (config round-trip unaffected)