Skip to content

Should $(opam env) or .opam/opam-init/* setup paths for shell completion scripts ? #6427

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

Open
dbuenzli opened this issue Mar 20, 2025 · 1 comment

Comments

@dbuenzli
Copy link
Contributor

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, MANPATH1). 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 ?

Footnotes

  1. On macos I don't know how, but invoking manpath has it.

@dbuenzli
Copy link
Contributor Author

From what I have understood so far.

This would entail:

  • For zsh, extending FPATH:
    FPATH="$(opam var share)/zsh/site-functions:${FPATH}"
  • For bash, (assuming bash-completion) extending XDG_DATA_DIRS:
    XDG_DATA_DIRS="$(opam var share):${XDG_DATA_DIRS}"
    (this makes bash look into $(opam var share)/bash-completion/completions).

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

No branches or pull requests

2 participants