[opam-devel] opam publish package name

Louis Gesbert louis.gesbert at ocamlpro.com
Fri Aug 28 01:33:36 BST 2015

> - Anil Madhavapeddy, 27/08/2015 14:10 -
> [...]
> One way to get around this would be to make the cmdliner structures available for plugins to link against in opam-lib.  The global ones especially could be used by every plugin and passed through to OPAM subcommands by setting the right environment variables (perhas https://github.com/dbuenzli/cmdliner/issues/23 would be of use for that).

This has been cleaned up and done just last week! So indeed for tools relying on the full opam-lib (i.e. opam-lib.client), you have either:

* a single function that does all the initialisation for you in the right way, with possible overrides through optional arguments (`OpamClientConfig.init`). In particular, it locates opamroot, loads the config file, initialises all opam libs reading from the env, in the right order and with the right priorities.
* a cmdliner term `OpamArg.global_options`, and a function `OpamArg.apply_global_options`, that contain all the options common to all opam commands, and does the above initialisation taking those into account respectively.

These should indeed make the lives of plugins easier (although not all rely on opam-lib, e.g. opam-depext which shouldn't rely on any external dependency).

This doesn't pass to sub-processes through the env at the moment, but that could be a good idea indeed.

More information about the opam-devel mailing list