Redesign the shell completion system. #1484, #1622
Support Bash >= 4.4, Zsh, and Fish, with the ability for extensions to add support for other shells.
Allow commands, groups, parameters, and types to override their completions suggestions.
Groups complete the names commands were registered with, which can differ from the name they were created with.
The autocompletion parameter for options and arguments is renamed to shell_complete. The function must take ctx, param, incomplete, must do matching rather than return all values, and must return a list of strings or a list of CompletionItem. The old name and behavior is deprecated and will be removed in 8.1.
The env var values used to start completion have changed order. The shell now comes first, such as {shell}source rather than source{shell}, and is always required.
Even if the release notes saying that the keyword "autocompletion" will be removed in 8.1 it seems to cause issues already in 8.0.x version. Therefore the pinning to the latest 7.x version.
Here the stacktrace if click>=8.0.4 is installed:
vscode ➜ /workspaces/python-rctclient (main ✗) $ rctclient
Traceback (most recent call last):
File "/home/vscode/.local/bin/rctclient", line 33, in <module>
sys.exit(load_entry_point('rctclient', 'console_scripts', 'rctclient')())
File "/home/vscode/.local/bin/rctclient", line 25, in importlib_load_entry_point
return next(matches).load()
File "/usr/local/lib/python3.10/importlib/metadata/__init__.py", line 162, in load
module = import_module(match.group('module'))
File "/usr/local/lib/python3.10/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/workspaces/python-rctclient/src/rctclient/cli.py", line 108, in <module>
def read_value(ctx, port: int, host: str, id: Optional[str], name: Optional[str], verbose: bool) -> None:
File "/home/vscode/.local/lib/python3.10/site-packages/click/decorators.py", line 308, in decorator
_param_memo(f, OptionClass(param_decls, **option_attrs))
File "/home/vscode/.local/lib/python3.10/site-packages/click/core.py", line 2495, in __init__
super().__init__(param_decls, type=type, multiple=multiple, **attrs)
TypeError: Parameter.__init__() got an unexpected keyword argument 'autocompletion'
The CLI seems to have issues with the latest major release of click 8.0.0 With 7.1.2 it is working well.
As a quickfix I will submit a PR to set the dependency to click==7.1.2.
From the recent release notes: https://click.palletsprojects.com/en/8.0.x/changes/#version-8-0
Even if the release notes saying that the keyword "autocompletion" will be removed in 8.1 it seems to cause issues already in 8.0.x version. Therefore the pinning to the latest 7.x version.
Here the stacktrace if click>=8.0.4 is installed: