LaunchConfigWizard launches the configuration wizard and returns the result.
(cfg *config.Config, configPath string, activeProfile string)
| 762 | |
| 763 | // LaunchConfigWizard launches the configuration wizard and returns the result. |
| 764 | func LaunchConfigWizard(cfg *config.Config, configPath string, activeProfile string) WizardResult { |
| 765 | tviewApp := tview.NewApplication() |
| 766 | tviewApp.SetInputCapture(keys.NormalizeNavigationEvent) |
| 767 | |
| 768 | // Apply theme configuration first, then apply to tview (same as main application) |
| 769 | theme.ApplyCustomTheme(&cfg.Theme) |
| 770 | theme.ApplyToTview() |
| 771 | |
| 772 | resultChan := make(chan WizardResult, 1) |
| 773 | wizard := NewConfigWizardPage(tviewApp, cfg, configPath, func(c *config.Config) error { |
| 774 | // The form now handles profile updates directly |
| 775 | return SaveConfigToFile(c, configPath) |
| 776 | }, func() { |
| 777 | tviewApp.Stop() |
| 778 | }, resultChan, activeProfile) |
| 779 | tviewApp.SetRoot(wizard, true) |
| 780 | _ = tviewApp.Run() |
| 781 | |
| 782 | return <-resultChan |
| 783 | } |
no test coverage detected