Reputation: 12837
I tried adding autocomplete using shtab but it doesn't work :(
The completion file (/etc/bash_completion.d/shtab) looks ok, but hitting TAB does nothing
Reproduce:
virtualenv -p python3.6 venv && . venv/bin/activate
pip install -U shtab
shtab --shell=bash shtab.main.get_main_parser --error-unimportable | sudo tee /etc/bash_completion.d/shtab
I changed the "$BASH_COMPLETION_COMPAT_DIR"/shtab
into /etc/bash_completion.d/shtab
because it is not relevant anymore (though I did also run the original command)
My environment:
Tried also on:
docker run -it python /bin/bash
)Is there an issue with my environment?
Upvotes: 0
Views: 347
Reputation: 14829
It may be that you are trying to complete something where there is nothing to complete. For example, shtab <TAB>
will do nothing since it has no subcommands. The same is true for cp <TAB>
, grep <TAB>
, etc.
Meanwhile, shtab -<TAB>
(and cp -<TAB>
, grep -<TAB>
, etc.) will happily complete the supported option flags. This comment may help: shtab#45@901736610.
Upvotes: 1