Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

completer falls back to Bash filename completion #482

Open
meonkeys opened this issue Apr 12, 2024 · 0 comments
Open

completer falls back to Bash filename completion #482

meonkeys opened this issue Apr 12, 2024 · 0 comments

Comments

@meonkeys
Copy link

It seems like the completer always falls back to Bash filename completion, even if --no-defaults is used.

I think this is a regression of #366.

Repro

  1. create virtual env: python3 -m venv argcomplete
  2. cd argcomplete
  3. activate virtual env: source bin/activate
  4. install latest argcomplete library: pip install argcomplete (v3.2.3)
  5. install test script in $PATH, make executable
  6. enable tab completion with, e.g. eval "$(register-python-argcomplete --no-defaults mytest-argcomplete)"
  7. type mytest-argcomplete --string Tab

Expected result

No output -- no completer is defined, and --no-defaults was used.

Actual result

Bash default tab completion for the current directory (in my case, the python venv):

bin/        include/    lib/        lib64/      pyvenv.cfg

Environment

  • ubuntu 22.04 LTS 64-bit desktop
  • python 3.10.12
  • bash 5.1.16
  • argcomplete v3.2.3

Test script

#!/home/user/argcomplete/bin/python3
# PYTHON_ARGCOMPLETE_OK

import argparse, argcomplete

parser = argparse.ArgumentParser()
parser.add_argument('-s', '--string')
argcomplete.autocomplete(parser)
args = parser.parse_args()

Workarounds

Don't hit Tab.

Start typing any string that isn't a prefix of anything in the current folder.

I tried manually setting up completion with complete -o nospace +o default +o bashdefault -F _python_argcomplete mytest-argcomplete or using compopt +o default, compopt +o bashdefault in the completion code, but that seems to break tab completion entirely (nothing completes).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant