Update pkg/cmd/plugin_update.go

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: MrJack <36191829+biagiopietro@users.noreply.github.com>
This commit is contained in:
MrJack 2026-03-09 09:49:11 +01:00
parent d097385cf3
commit 3ed4d4ff01

View file

@ -92,7 +92,11 @@ func (o *pluginUpdateOptions) complete(args []string) error {
}
if version != "" {
if _, err := semver.StrictNewVersion(version); err != nil {
return fmt.Errorf("invalid version %q for plugin %q: must be an exact semver version (e.g. 1.2.3); the \"v\" prefix is not allowed", version, name)
errMsg := fmt.Sprintf("invalid version %q for plugin %q: must be an exact semver version (e.g. 1.2.3); semver range constraints (e.g. ~1.2, ^1.0.0, >=1.0.0) are not supported", version, name)
if strings.HasPrefix(version, "v") {
errMsg += `; the "v" prefix is not allowed`
}
return fmt.Errorf("%s", errMsg)
}
}
o.plugins[name] = version