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

Function runMainApplication

internal/cli/root.go:53–75  ·  view source on GitHub ↗

runMainApplication runs the main application

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

Source from the content-addressed store, hash-verified

51
52// runMainApplication runs the main application
53func runMainApplication(cmd *cobra.Command, args []string) error {
54 opts := getBootstrapOptions(cmd)
55
56 // Bootstrap the application
57 result, err := bootstrap.Bootstrap(opts)
58 if err != nil {
59 return fmt.Errorf("bootstrap failed: %w", err)
60 }
61
62 // If result is nil, the application should exit (e.g., version flag)
63 if result == nil {
64 return nil
65 }
66
67 // Start the main application
68 // Handle application runtime errors differently from CLI usage errors
69 if err := bootstrap.StartApplication(result); err != nil {
70 // Application runtime error - exit directly without showing usage
71 os.Exit(1)
72 }
73
74 return nil
75}
76
77// getBootstrapOptions converts cobra flags to BootstrapOptions
78func getBootstrapOptions(cmd *cobra.Command) bootstrap.BootstrapOptions {

Callers

nothing calls this directly

Calls 3

BootstrapFunction · 0.92
StartApplicationFunction · 0.92
getBootstrapOptionsFunction · 0.85

Tested by

no test coverage detected