MCPcopy
hub / github.com/jesseduffield/lazygit / SaveGlobalUserConfig

Method SaveGlobalUserConfig

pkg/config/app_config.go:679–693  ·  view source on GitHub ↗

SaveGlobalUserConfig saves the UserConfig back to disk. This is only used in integration tests, so we are a bit sloppy with error handling.

()

Source from the content-addressed store, hash-verified

677// SaveGlobalUserConfig saves the UserConfig back to disk. This is only used in
678// integration tests, so we are a bit sloppy with error handling.
679func (c *AppConfig) SaveGlobalUserConfig() {
680 if len(c.globalUserConfigFiles) != 1 {
681 panic("expected exactly one global user config file")
682 }
683
684 yamlContent, err := yaml.Marshal(c.userConfig)
685 if err != nil {
686 log.Fatalf("error marshalling user config: %v", err)
687 }
688
689 err = os.WriteFile(c.globalUserConfigFiles[0].Path, yamlContent, 0o644)
690 if err != nil {
691 log.Fatalf("error saving user config: %v", err)
692 }
693}
694
695// AppState stores data between runs of the app like when the last update check
696// was performed and which other repos have been checked out

Callers 1

StartFunction · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected