Feature Request: elvish support
I use the elvish shell (https://elvish.io/) and I currently manually this code to set up my environment:
paths = [~/.opam/4.04.0/bin ~/bin /usr/local/bin /usr/bin /bin /usr/sbin /sbin]
E:CAML_LD_LIBRARY_PATH = /Users/schmitta/.opam/4.04.0/lib/stublibs
E:OPAMUTF8MSGS = 1
E:MANPATH = /Users/schmitta/.opam/4.04.0/man:
E:PERL5LIB = /Users/schmitta/.opam/4.04.0/lib/perl5
E:OCAML_TOPLEVEL_PATH = /Users/schmitta/.opam/4.04.0/lib/toplevel
Is it difficult to tweak opam config env to support this format?
Supporting new shells is pretty straightforward, yes - would you like to have a go at a patch (either @AltGr or I happy to provide more pointers on where the changes need to go, but it's essentially adding a constructor to a type and then updating various match clauses)
@dra27 I'd gladly give it a try, and I would happily have pointers to places to change. Should the PR be based on master?
@brabalan Yes, PRs are based on master.
You can find two entrypoints for new shell support: OpamStd and OpamEnv.
For needed external scripts files (copied in ~/.opam/opam-init/), they are here and you should add the in OpamScript like in this this commit.
The environment output for csh is syntactically very close to Elvish. With a small modification, it can be used directly. This one-liner replaces setenv with set-env and evaluates the result:
opam env --shell csh | each {|line| eval (str:replace setenv set-env $line) }
This works reliably for me. Posting it here in case it's helpful for others or could serve as a starting point for an official implementation. I'd be happy to see native Elvish support in the future.