LoadFromConfig populates settings items from a config.
(cfg *config.Config)
| 56 | |
| 57 | // LoadFromConfig populates settings items from a config. |
| 58 | func (s *SettingsOverlay) LoadFromConfig(cfg *config.Config) { |
| 59 | s.items = []SettingsItem{ |
| 60 | {Section: "Worktree", Label: "Setup command", Key: "worktree.setup", Type: SettingsItemString, StringVal: cfg.Worktree.Setup}, |
| 61 | {Section: "On Complete", Label: "Push to remote", Key: "onComplete.push", Type: SettingsItemBool, BoolVal: cfg.OnComplete.Push}, |
| 62 | {Section: "On Complete", Label: "Create pull request", Key: "onComplete.createPR", Type: SettingsItemBool, BoolVal: cfg.OnComplete.CreatePR}, |
| 63 | } |
| 64 | s.selectedIndex = 0 |
| 65 | s.editing = false |
| 66 | s.editBuffer = "" |
| 67 | s.ghError = "" |
| 68 | s.showGHError = false |
| 69 | } |
| 70 | |
| 71 | // ApplyToConfig writes the current settings values back to a config. |
| 72 | func (s *SettingsOverlay) ApplyToConfig(cfg *config.Config) { |
no outgoing calls