Skip to content

{Auto Complete} Fix default completer#15599

Merged
fengzhou-msft merged 2 commits intoAzure:devfrom
fengzhou-msft:fix_default_completer
Oct 22, 2020
Merged

{Auto Complete} Fix default completer#15599
fengzhou-msft merged 2 commits intoAzure:devfrom
fengzhou-msft:fix_default_completer

Conversation

@fengzhou-msft
Copy link
Member

@fengzhou-msft fengzhou-msft commented Oct 21, 2020

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
Collaborator

yonzhan commented Oct 21, 2020

Which platform does it support?

Copy link
Contributor

@houk-ms houk-ms left a comment

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
Member Author

Which platform does it support?

Linux and macOS.

Copy link
Contributor

@arrownj arrownj left a comment

Choose a reason for hiding this comment

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

💯

@fengzhou-msft fengzhou-msft merged commit d1d165e into Azure:dev Oct 22, 2020
@houk-ms
Copy link
Contributor

houk-ms commented Oct 26, 2020

#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