Skip to content

{Auto Complete} Fix default completer - #15599

Merged
Feng Zhou (fengzhou-msft) merged 2 commits into
Azure:devfrom
fengzhou-msft:fix_default_completer
Oct 22, 2020
Merged

{Auto Complete} Fix default completer#15599
Feng Zhou (fengzhou-msft) merged 2 commits into
Azure:devfrom
fengzhou-msft:fix_default_completer

Conversation

@fengzhou-msft

@fengzhou-msft Feng Zhou (fengzhou-msft) commented Oct 21, 2020

Copy link
Copy Markdown
Member

Description

Fix #3807

The current default completer only takes one positional argument and will throw an error when invoked in argcomplete with keyword argument:
https://github.com/kislyuk/argcomplete/blob/a93a4f4dc785373f320d168d2d5a1a11bdc50315/argcomplete/__init__.py#L452-L454
completer(prefix=cword_prefix, action=active_action, parser=parser, parsed_args=parsed_args)

This PR makes the default completer take any number of positional or keyword arguments.

Testing Guide

On Ubuntu, turn on argcomplete debug with:
export _ARC_DEBUG=1

Type the following command and press tab key.
az vm show --ids /sub

You can see the error: TypeError: <lambda>() got an unexpected keyword argument 'prefix'

Apply the change in this PR to argcomplete by running:
eval "$(register-python-argcomplete az)"

Repeat the step for tab completion and the error is gone.

History Notes

[Component Name 1] BREAKING CHANGE: az command a: Make some customer-facing breaking change.
[Component Name 2] az command b: Add some customer-facing feature.


This checklist is used to make sure that common guidelines for a pull request are followed.

@yonzhan

Copy link
Copy Markdown
Collaborator

Which platform does it support?

@houk-ms Houk (houk-ms) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great findings! It would help reduce A LOT of the client side TypeErrors!

@fengzhou-msft

Copy link
Copy Markdown
Member Author

Which platform does it support?

Linux and macOS.

@arrownj Xiaojian Xu (arrownj) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

@fengzhou-msft
Feng Zhou (fengzhou-msft) merged commit d1d165e into Azure:dev Oct 22, 2020
@houk-ms

Copy link
Copy Markdown
Contributor

#15314

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

According to telemetry, we have a problem with tab completion

5 participants