I’ve packaged a CLI tool written in python, with a dependency on argcomplete. Enabling autocompletion requires running the following in the shell (e.g. in bashrc or similar):
eval "$(register-python-argcomplete my-cli)"
Though my package works (the CLI can be used), the “register-python-argcomplete” command (provided by argcomplete) is not installed in the user-environment. I can remedy this by installing argcomplete separately.
I’m using pypi2nix. My default.nix lists argcomplete in its propagatedBuilldInputs, but I guess propagating the argcomplete library to my CLI’s runtime environment is not the same as propagating its executables to the user’s environment.
Is there a way I could propagate this command to the user environment? Would that be bad practice?
I’m also considering adding a wrapper script in my $out/bin along the lines of:
/path/to/register-python-argcomplete my-cli
That would avoid interfering with any existing installation of argcomplete in the user’s environment. I’m not sure how I’d implement this though.