CIsForCookies
CIsForCookies

Reputation: 12837

shtab tab-completion not working after following instructions

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:

  1. virtualenv -p python3.6 venv && . venv/bin/activate
  2. pip install -U shtab
  3. 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:

  1. zsh==5.4.2
  2. Docker (docker run -it python /bin/bash)

Is there an issue with my environment?

Upvotes: 0

Views: 347

Answers (1)

casper.dcl
casper.dcl

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

Related Questions