tldr-node-client icon indicating copy to clipboard operation
tldr-node-client copied to clipboard

Move completion files to the right directory when installing tldr

Open marchersimon opened this issue 4 years ago • 3 comments

The completion files at bin/completion for bash and zsh currently aren't copied anywhere, so they cannot be seen by bash or zsh.

For bash completion files have to go to /usr/share/bash-completion/completions/.

For zsh completion files have to be in any directory in $fpath (e.g. /usr/share/zsh/functions/Completion/Zsh/).

Is there a reason this hasn't been done yet?

marchersimon avatar Apr 22 '21 19:04 marchersimon

Is there a reason this hasn't been done yet?

Because the only way to do that is to utilize a post-install script which is considered a kinda grey zone territory. Some folks explicitly prevent those from running using either npm config or the corresponding installation-time CLI option.

vladimyr avatar Apr 23 '21 04:04 vladimyr

As I mentioned here https://github.com/tldr-pages/tldr-node-client/issues/311#issuecomment-790728537 cleaner way would be to implement completion subcommand like:

tldr completion bash
# or
tldr completion zsh

which would then output the completion code for the requested shell. That way users can either add it to their profile or write to completion dirs you already listed. And they would have to do that manually as opposed to running stuff behind their back.

vladimyr avatar Apr 23 '21 04:04 vladimyr

I agree @vladimyr, a subcommand would probably be the best option and is also pretty common. 👍🏻

owenvoke avatar Apr 23 '21 09:04 owenvoke