Add `opam repo show <reponame>` support
Related to issue https://github.com/ocaml/opam/issues/6235.
Adding a new command that will allow us to get the URL and Rank of a specific repo.
Also supports all (will display the url and rank of a repo for every switch):
$ opam repo show default --all
(sorry, I can't get past .. as meaning the parent directory!)
There are some other commands with the same behaviour (abc is not defined):
$ opam repo list --switch=abc
[NOTE] These are the repositories in use by the current switch. Use '--all'
to see all configured repositories.
<><> Repository configuration for switch abc <><><><><><><><><><><><><><><><>
1 default https://opam.ocaml.org
Reading more the code, I found that the actual flag to select switch is --on-switch (defined here). This will produce the expected behaviour (error in case of non-existing switch).
Because --switch=<switch> doesn't populate the `Switch <switch>:
https://github.com/ocaml/opam/blob/ce734b35a18bc98642f7212a280dc4d6c64c969f/src/client/opamCommands.ml#L2375-L2383
Could you please verify?
Ah my bad, i thought --switch would do it without looking at the man page because of the name of the variant. --on-switch works as expected indeed.
I think we should fix --switch separately. I'll open a ticket.
Hey @kit-ty-kate, I made the above changes.
Wait for switch, then parse each line in this context until a new line starting with switch: ?
Yes, the output should be a name, url and rank.
It now works with -a and without repo_name (it will list all repos for the current switch) and the error message is better now.