MCPcopy Create free account
hub / github.com/devnullvoid/pvetui / runConfigWizard

Function runConfigWizard

internal/cli/commands.go:31–59  ·  view source on GitHub ↗

runConfigWizard executes the config wizard

(cmd *cobra.Command, args []string)

Source from the content-addressed store, hash-verified

29
30// runConfigWizard executes the config wizard
31func 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}

Callers

nothing calls this directly

Calls 5

MergeWithFileMethod · 0.95
SetDefaultsMethod · 0.95
NewConfigFunction · 0.92
HandleConfigWizardFunction · 0.92

Tested by

no test coverage detected