MCPcopy Index your code
hub / github.com/docker/docker-agent / persistSplitDiffView

Function persistSplitDiffView

pkg/tui/handlers.go:426–439  ·  view source on GitHub ↗

persistSplitDiffView writes the current split-diff toggle to the user config without blocking the UI. Errors are logged but otherwise ignored because losing the persistence is non-fatal.

(enabled bool)

Source from the content-addressed store, hash-verified

424// config without blocking the UI. Errors are logged but otherwise ignored
425// because losing the persistence is non-fatal.
426func persistSplitDiffView(enabled bool) {
427 cfg, err := userconfig.Load()
428 if err != nil {
429 slog.Warn("Failed to load userconfig for split diff toggle", "error", err)
430 return
431 }
432 if cfg.Settings == nil {
433 cfg.Settings = &userconfig.Settings{}
434 }
435 cfg.Settings.SplitDiffView = &enabled
436 if err := cfg.Save(); err != nil {
437 slog.Warn("Failed to persist split diff setting to userconfig", "error", err)
438 }
439}
440
441// --- Dialogs ---
442

Callers 1

handleToggleSplitDiffMethod · 0.85

Calls 3

LoadFunction · 0.92
WarnMethod · 0.80
SaveMethod · 0.80

Tested by

no test coverage detected