Skip to content

Improve performance of Chocolatey CLI tab completionsย #3823

@gep13

Description

@gep13

Checklist

  • I have verified this is the correct repository for opening this issue.
  • I have verified no other issues exist related to my request.

Is Your Feature Request Related To A Problem? Please describe.

Some Tab Expansions, coming from the ChocolateyTabExpansion.ps1 file, can be slow to complete.

Describe The Solution. Why is it needed?

After some discussions with @AdmiringWorm a few ideas were discussed to improve the overall performance of the tab completions. The winnder from those discussions was to cache the information that is needed to in a file to disk, and have the tab completions use this file(s) to populate the completions.

For example, run the choco config list command, and save the information to disk. Then when someone does choco config set --name=<tab>, rather than having to run the choco config list command to allow cycling through that information, the information is already availalbe in a file on disk, making the look up much faster.

This approach could be used for almost all of the tab completions, by capturing the information from:

  • choco -h - to get all available commands
  • choco apikey list
  • choco config list
  • choco feature list
  • choco list
  • choco list --ignore-pinned
  • choco pin list
  • choco rule list
  • choco source list
  • choco template list

On top of capturing this information, we could also look to refresh the information when we "know" that something is changing. For example, when some of the following commands are run:

  • choco source add
  • choco config set
  • choco config unset
  • choco feature enable
  • etc

That would be an "easy" way to keep the information up to date, without having to schedule updating of the files, or by some other mechanism.

The only tab expansion that we would not be able to provide any improvement to with this solution would be the information needed when doing choco search. This would be able to be improved once we complete package indexes.

Additional Context

N/A

Related Issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    EnhancementIssues that introduce new functionality to the project, or enhances/updates existing functionality.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions