MCPcopy
hub / github.com/helm/helm / GetPluginName

Function GetPluginName

pkg/registry/plugin.go:184–206  ·  view source on GitHub ↗

GetPluginName extracts the plugin name from an OCI reference using proper reference parsing

(source string)

Source from the content-addressed store, hash-verified

182
183// GetPluginName extracts the plugin name from an OCI reference using proper reference parsing
184func GetPluginName(source string) (string, error) {
185 ref, err := newReference(source)
186 if err != nil {
187 return "", fmt.Errorf("invalid OCI reference: %w", err)
188 }
189
190 // Extract plugin name from the repository path
191 // e.g., "ghcr.io/user/plugin-name:v1.0.0" -> Repository: "user/plugin-name"
192 repository := ref.Repository
193 if repository == "" {
194 return "", errors.New("invalid OCI reference: missing repository")
195 }
196
197 // Get the last part of the repository path as the plugin name
198 parts := strings.Split(repository, "/")
199 pluginName := parts[len(parts)-1]
200
201 if pluginName == "" {
202 return "", fmt.Errorf("invalid OCI reference: cannot determine plugin name from repository %s", repository)
203 }
204
205 return pluginName, nil
206}
207
208// PullPluginOptWithProv configures the pull to fetch provenance data
209func PullPluginOptWithProv(withProv bool) PluginPullOption {

Callers 2

NewOCIInstallerFunction · 0.92
TestGetPluginNameFunction · 0.85

Calls 1

newReferenceFunction · 0.85

Tested by 1

TestGetPluginNameFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…