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

Function RunApp

internal/ui/app_runner.go:17–49  ·  view source on GitHub ↗

RunApp creates and starts the application using the component-based architecture.

(ctx context.Context, client *api.Client, cfg *config.Config, configPath string, initialGroup string)

Source from the content-addressed store, hash-verified

15
16// RunApp creates and starts the application using the component-based architecture.
17func RunApp(ctx context.Context, client *api.Client, cfg *config.Config, configPath string, initialGroup string) error {
18 app := components.NewApp(ctx, client, cfg, configPath, initialGroup)
19
20 metadata := plugins.AvailableMetadata()
21 catalog := make([]components.PluginInfo, len(metadata))
22 for i, entry := range metadata {
23 catalog[i] = components.PluginInfo{
24 ID: entry.ID,
25 Name: entry.Name,
26 Description: entry.Description,
27 }
28 }
29 app.SetPluginCatalog(catalog)
30
31 pluginInstances, missing := plugins.EnabledFromConfig(cfg)
32 if len(missing) > 0 {
33 fmt.Println(display.IconText("⚠️", fmt.Sprintf("Unknown plugins requested: %s", strings.Join(missing, ", ")), cfg.ShowIcons))
34 }
35
36 if err := app.InitializePlugins(ctx, pluginInstances); err != nil {
37 return err
38 }
39
40 defer func() {
41 shutdownCtx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
42 defer cancel()
43 if err := app.ShutdownPlugins(shutdownCtx); err != nil {
44 fmt.Println(display.IconText("⚠️", fmt.Sprintf("Failed to shutdown plugins: %v", err), cfg.ShowIcons))
45 }
46 }()
47
48 return app.Run()
49}

Callers 1

Calls 8

SetPluginCatalogMethod · 0.95
InitializePluginsMethod · 0.95
ShutdownPluginsMethod · 0.95
RunMethod · 0.95
NewAppFunction · 0.92
AvailableMetadataFunction · 0.92
EnabledFromConfigFunction · 0.92
IconTextFunction · 0.92

Tested by

no test coverage detected