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

Proposal: make krew info work with multiple indexes #559

Closed
ahmetb opened this issue Mar 28, 2020 · 4 comments · Fixed by #563
Closed

Proposal: make krew info work with multiple indexes #559

ahmetb opened this issue Mar 28, 2020 · 4 comments · Fixed by #563

Comments

@ahmetb
Copy link
Member

ahmetb commented Mar 28, 2020

Since we had 1 index up until now, krew index had been fairly easy to implement. It did not distinguish between Receipts or Plugins (ref: LoadManifestFromReceiptOrIndex).

In other words, an "installed" plugin could only come from the Plugin manifest with the same name –as there were no other index.

So now, by allowing multiple indexes, krew info now has to understand if:

krew info foo

means foo the installed plugin (could be from any index), or the default/foo uninstalled plugin.


Option 1

I recommend we change krew info’s behavior. krew info foo means:

  • show info of foo installed plugin (could be from any index)
  • show info of foo uninstalled plugin (from default index)

To disambiguate an "uninstalled" plugin, the user can run krew info my-index/foo. However, if my-index/foo is installed, could the user have meant show the "installed" plugin?

Keep in mind that krew info works on plugins installed via --manifest (i.e. has no index, but recorded as default with #555).

I'm losing my train of thought here.
If you see a straightforward solution, let me know.
/cc @corneliusweig
cc: @chriskim06
/kind proposal
/area multi-index

@ahmetb
Copy link
Member Author

ahmetb commented Mar 28, 2020

Option 2

I think I found a simplification/refinement:

We change krew info's behavior to only look at "available" plugins. It never looks at installed plugin receipts.

krew info foo # -> show default/foo
krew info my-index/foo

Advantages:

  • easy to document for us, and easy to understand for users
  • if we want to show if the plugin showed is_installed:true/false in "krew info" output, we can just query receipt by name and match the source index name.

Disadvantages:

  • plugins installed but that don't exist in an index (i.e. installed via --manifest) (or index is deleted ==not supported) won't show here. I think it's an acceptable trade-off.

@corneliusweig
Copy link
Contributor

corneliusweig commented Mar 28, 2020

I generally prefer option 2 over option 1, because it is more predictable and yields the same result regardless on which machine the command is executed on.

To make our user's lives easier, we can offer them some guidance when no manifest is found. For example, when looking for plugin bar from my-index:

$ krew info bar
Plugin `default/bar` does not exist. Did you mean `krew info my-index/bar`?

Lastly, the inconvenience about not being able to show info about plugins installed via --manifest is not a small thing IMO. Plugin devs will want to see how their info prints on screen and they should be able to. To that end, we could add an option --installed that will force reading the manifest from the receipts folder. WDYT?

@ahmetb
Copy link
Member Author

ahmetb commented Mar 28, 2020

Lastly, the inconvenience about not being able to show info about plugins installed via --manifest is not a small thing IMO. Plugin devs will want to see how their info prints on screen and they should be able to. To that end, we could add an option --installed that will force reading the manifest from the receipts folder. WDYT?

I think for those people, I'd much rather prefer if krew info --manifest exists. :) That way, we make info work on Plugin concept only.

@corneliusweig
Copy link
Contributor

Yeah, that's even better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants