runConfigWizard executes the config wizard
(cmd *cobra.Command, args []string)
| 29 | |
| 30 | // runConfigWizard executes the config wizard |
| 31 | func runConfigWizard(cmd *cobra.Command, args []string) error { |
| 32 | // Get config path from flags |
| 33 | configPath, _ := cmd.Flags().GetString("config") |
| 34 | profileName, _ := cmd.Flags().GetString("profile") |
| 35 | |
| 36 | // Create a new config |
| 37 | cfg := config.NewConfig() |
| 38 | |
| 39 | // Resolve config path |
| 40 | resolvedPath := bootstrap.ResolveConfigPathForWizard(configPath) |
| 41 | |
| 42 | // Load existing config if it exists |
| 43 | if resolvedPath != "" { |
| 44 | _ = cfg.MergeWithFile(resolvedPath) // Ignore errors for config wizard |
| 45 | } |
| 46 | |
| 47 | // Set defaults for config wizard |
| 48 | cfg.SetDefaults() |
| 49 | |
| 50 | // If a specific profile is requested for the wizard, set it as default |
| 51 | // This signals the wizard to edit/create this specific profile |
| 52 | if profileName != "" { |
| 53 | cfg.DefaultProfile = profileName |
| 54 | } |
| 55 | |
| 56 | // Run the config wizard |
| 57 | // We pass profileName as activeProfile, though the wizard largely relies on cfg.DefaultProfile |
| 58 | return bootstrap.HandleConfigWizard(cfg, resolvedPath, profileName) |
| 59 | } |
nothing calls this directly
no test coverage detected