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.
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 toAutocomplete: false
.Luckily our tests already "black-box" (mostly) tested autocompletion so this change can verify that autocompletion still works.