Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Jul 22, 2024. It is now read-only.

Conversation

mitchellh
Copy link
Owner

@mitchellh mitchellh commented Apr 3, 2020

Setting up the autocomplete command requires initializing and walking
through every subcommand in order to get their completion
implementations. This means that if Autocomplete: true is on the CLI,
every command is initialized on every single invocation.

This PR changes it so that we only initialize the autocompletion command
if we detect that we're actually being invoked for autocompletion.

The practical impact is that if Autocomplete: true now and you're NOT
actively autocompleting then we will only init and run the command that
is requested. This is identical behavior to Autocomplete: false.

Luckily our tests already "black-box" (mostly) tested autocompletion so
this change can verify that autocompletion still works.

Setting up the autocomplete command requires initializing and walking
through every subcommand in order to get their completion
implementations. This means that if `Autocomplete: true` is on the CLI,
every command is initialized on every single invocation.

This PR changes it so that we only initialize the autocompletion command
if we detect that we're actually being invoked for autocompletion.

Luckily our tests already "black-box" (mostly) tested autocompletion so
this change can verify that autocompletion still works.
@mitchellh mitchellh merged commit 171fbb5 into master Apr 6, 2020
@mitchellh mitchellh deleted the noop-autocomplete branch April 6, 2020 19:53
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants