Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor ListInstalledPlugins #558

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions cmd/krew/cmd/search.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ Examples:
if err != nil {
return errors.Wrap(err, "failed to load installed plugins")
}

// TODO(chriskim06) include index name when refactoring for custom indexes
installed := make(map[string]string)
for _, receipt := range receipts {
installed[receipt.Name] = receipt.Spec.Version
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this sounds wrong. what if two plugins with identical names from different indexes exist? it'll show both as installed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is here to preserve the existing functionality. I'm not trying to update search to work with custom indexes in this PR.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah makes sense. That said do you mind adding a TODO so we don't forget these things? The same works below, too.

Expand Down
1 change: 1 addition & 0 deletions cmd/krew/cmd/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ func ensureIndexUpdated(_ *cobra.Command, _ []string) error {
installedPlugins[receipt.Name] = receipt.Spec.Version
}

// TODO(chriskim06) consider commenting this out when refactoring for custom indexes
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not quite commenting out, but I think we need to pass a similar Pair<indexName,plugin> here as well :) :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ya pluginEntry would be available here. I was just making a note of possibly commenting out the show updated plugins feature like you mentioned in your other comment

showUpdatedPlugins(os.Stderr, preUpdateIndex, posUpdateIndex, installedPlugins)

return nil
Expand Down