Should $(opam env) or .opam/opam-init/* setup paths for shell completion scripts ?
I'm not sure whether this belongs to the opam-repository or here but since this could interact with what opam does for shell detection I'm doing it here.
opam extends quite a few configuration paths so that stuffs gets looked up in the opam prefix (e.g. PATH, MANPATH[^1]). I was wondering if perhaps opam could do the same for shell completion scripts according to the current shell. That way packages can simply install completion scripts in the prefix where the various shell expect them and they get automatically picked up by the user shell as packages come and go.
It seems at least me an another person are interested :-)
What do you think ?
[^1]: On macos I don't know how, but invoking manpath has it.
From what I have understood so far.
This would entail:
- For
zsh, extendingFPATH:FPATH="$(opam var share)/zsh/site-functions:${FPATH}" - For
bash, (assumingbash-completion) extendingXDG_DATA_DIRS:
(this makesXDG_DATA_DIRS="$(opam var share):${XDG_DATA_DIRS}"bashlook into$(opam var share)/bash-completion/completions).
In fact I really think it should because otherwise, if the users do that themselves as suggested here, they get all sorts of confusing behaviours as they opam switch.
I have some spare cycles to implement this if it's desirable to the opam maintainers
It seems to me like opam env is the natural place, given that it currently handles MANPATH?
@WardBrian we haven't thought about it much so far (there may be security concerns, idk), but a PR is always appreciated. opam env is probably the place yes