Signed-off-by: Suleiman Dibirov <idsulik@gmail.com>
pull/31403/head
Suleiman Dibirov 12 months ago
parent 2b787a1efd
commit 6ea425b732

@ -146,7 +146,7 @@ func (i *HTTPInstaller) Update() error {
return fmt.Errorf("method Update() not implemented for HttpInstaller") 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) { func (i *HTTPInstaller) GetLatestVersion() (string, error) {
return "", fmt.Errorf("not supported") return "", fmt.Errorf("not supported")
} }

@ -58,7 +58,11 @@ func newPluginListCmd(out io.Writer) *cobra.Command {
signingInfo := plugin.GetSigningInfoForPlugins(plugins) signingInfo := plugin.GetSigningInfoForPlugins(plugins)
table := uitable.New() 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 { for _, p := range plugins {
m := p.Metadata() m := p.Metadata()
sourceURL := m.SourceURL sourceURL := m.SourceURL
@ -71,13 +75,16 @@ func newPluginListCmd(out io.Writer) *cobra.Command {
signedStatus = info.Status signedStatus = info.Status
} }
latest, err := getLatestVersion(p) if o.showOutdated {
if err != nil { latest, err := getLatestVersion(p)
latest = "unknown" 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) 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) fmt.Fprintln(out, table)

Loading…
Cancel
Save