Skip to content

Conversation

@pschmitt
Copy link
Contributor

This fixes the following:

hass-cli service call <TAB>
'tuple' object has no attribute 'type'Traceback (most recent call last):
  File "/home/pschmitt/.local/share/zinit/plugins/home-assistant-ecosystem---home-assistant-cli/homeassistant_cli/cli.py", line 40, in run
    result = cli.main(standalone_mode=False)
  File "/home/pschmitt/.local/pipx/venvs/homeassistant-cli/lib/python3.10/site-packages/click/core.py", line 1050, in main
    self._main_shell_completion(extra, prog_name, complete_var)
  File "/home/pschmitt/.local/pipx/venvs/homeassistant-cli/lib/python3.10/site-packages/click/core.py", line 1125, in _main_shell_completion
    rv = shell_complete(self, ctx_args, prog_name, complete_var, instruction)
  File "/home/pschmitt/.local/pipx/venvs/homeassistant-cli/lib/python3.10/site-packages/click/shell_completion.py", line 49, in shell_complete
    echo(comp.complete())
  File "/home/pschmitt/.local/pipx/venvs/homeassistant-cli/lib/python3.10/site-packages/click/shell_completion.py", line 292, in complete
    out = [self.format_completion(item) for item in completions]
  File "/home/pschmitt/.local/pipx/venvs/homeassistant-cli/lib/python3.10/site-packages/click/shell_completion.py", line 292, in <listcomp>
    out = [self.format_completion(item) for item in completions]
  File "/home/pschmitt/.local/pipx/venvs/homeassistant-cli/lib/python3.10/site-packages/click/shell_completion.py", line 364, in format_completion
    return f"{item.type}\n{item.value}\n{item.help if item.help else '_'}

Click Completions should now return CompletionItem instances, instead of tuples.

Ref: https://github.com/pallets/click/blob/8.1.3/docs/shell-completion.rst#custom-type-completion

@pschmitt
Copy link
Contributor Author

pschmitt commented Feb 22, 2023

Have to admit that I can't figure out why the area completions test is failing 😐

EDIT: The area completion tests fail because get_areas() is a WS request that cannot be mocked by request_mock

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

Successfully merging this pull request may close these issues.

1 participant