Python argcomplete, setting in /etc/bash_completion.d/

41 Views Asked by At

I am writing a system utility in Python that I am placing directly in /usr/bin/myScript.

I want to setup my script with argcomplete globally, where a user doesn't need to run the eval "$(register-python-argcomplete3 /usr/bin/myScript)" command. This eval command is successful, but just not global.

I am trying to accomplish this by piping the output to a bash completion file: register-python-argcomplete3 myScript > /etc/bash_completion.d/myScript, but this fails to make the autocomplete happen (nothing happens on tabbing the script options in terminal). I have also tried logging out and back in, also rebooting for good measure.

I also have the # PYTHON_ARGCOMPLETE_OK directive at the top of my script (under #!/bin/python3), but how this works is a little confusing and unintuitive, and not much comes of the activate-global-python-argcomplete command seemingly. The /etc/bash_completion.d/python-argcomplete script is created, but still no autocomplete for my script.

How can I make sure the autocomplete is available for my script globally?

0

There are 0 best solutions below