diff --git a/internal/plugin/installer/http_installer.go b/internal/plugin/installer/http_installer.go index 154d31a59..d7ec2e400 100644 --- a/internal/plugin/installer/http_installer.go +++ b/internal/plugin/installer/http_installer.go @@ -146,7 +146,7 @@ func (i *HTTPInstaller) Update() error { return fmt.Errorf("method Update() not implemented for HttpInstaller") } -// GetLatestVersion fetches the latest version of the plugin.Add a comment on lines R158 to R160Add diff commentMarkdown input: edit mode selected.WritePreviewAdd a suggestionHeadingBoldItalicQuoteCodeLinkUnordered listNumbered listTask listMentionReferenceSaved repliesAdd FilesPaste, drop, or click to add filesCancelCommentStart a reviewReturn to code +// GetLatestVersion fetches the latest version of the plugin. func (i *HTTPInstaller) GetLatestVersion() (string, error) { return "", fmt.Errorf("not supported") } diff --git a/pkg/cmd/plugin_list.go b/pkg/cmd/plugin_list.go index 7fbb31fc0..a10bcb450 100644 --- a/pkg/cmd/plugin_list.go +++ b/pkg/cmd/plugin_list.go @@ -58,7 +58,11 @@ func newPluginListCmd(out io.Writer) *cobra.Command { signingInfo := plugin.GetSigningInfoForPlugins(plugins) table := uitable.New() - table.AddRow("NAME", "VERSION", "LATEST", "TYPE", "APIVERSION", "PROVENANCE", "SOURCE") + if o.showOutdated { + table.AddRow("NAME", "VERSION", "LATEST", "TYPE", "APIVERSION", "PROVENANCE", "SOURCE") + } else { + table.AddRow("NAME", "VERSION", "TYPE", "APIVERSION", "PROVENANCE", "SOURCE") + } for _, p := range plugins { m := p.Metadata() sourceURL := m.SourceURL @@ -71,13 +75,16 @@ func newPluginListCmd(out io.Writer) *cobra.Command { signedStatus = info.Status } - latest, err := getLatestVersion(p) - if err != nil { - latest = "unknown" - } + if o.showOutdated { + latest, err := getLatestVersion(p) + if err != nil { + slog.Debug("getLatestVersion", err.Error()) + latest = "unknown" + } - if !o.showOutdated || (latest != "unknown" && latest != m.Version) { table.AddRow(m.Name, m.Version, latest, m.Type, m.APIVersion, signedStatus, sourceURL) + } else { + table.AddRow(m.Name, m.Version, m.Type, m.APIVersion, signedStatus, sourceURL) } } fmt.Fprintln(out, table)