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

Function GetScriptsByCategory

internal/plugins/communityscripts/scripts.go:538–559  ·  view source on GitHub ↗

GetScriptsByCategory returns scripts for a specific category.

(category string)

Source from the content-addressed store, hash-verified

536
537// GetScriptsByCategory returns scripts for a specific category.
538func GetScriptsByCategory(category string) ([]Script, error) {
539 allScripts, err := FetchScripts()
540 if err != nil {
541 return nil, err
542 }
543
544 // Filter scripts by category
545 var categoryScripts []Script
546
547 for _, script := range allScripts {
548 // If the script path starts with the category name or the type matches
549 if strings.HasPrefix(script.ScriptPath, category+"/") || script.Type == category {
550 categoryScripts = append(categoryScripts, script)
551 }
552 }
553
554 if len(categoryScripts) == 0 {
555 return nil, fmt.Errorf("no scripts found for category: %s", category)
556 }
557
558 return categoryScripts, nil
559}
560
561// InstallScript installs a script on a Proxmox node interactively.
562func validateScriptPath(scriptPath string) error {

Callers

nothing calls this directly

Calls 1

FetchScriptsFunction · 0.70

Tested by

no test coverage detected