chocolatey / chocolatey/choco

Improvements to Tab Expansion (Multiple Packages, allow dash)

Open
#2,287 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
11.5k
Forks
960
PR merge metrics
No merged PRs in 30d

Description

When using tab completion there's two issues I often run into:

* I want to update multiple packages, but tab expansion only works for the first package listed
* I type something like **choco upgrade dotnet-** the expansion stops working.

Luckily, these are pretty easy fixes, that can be achieved by updating the regexes:

```
^upgrade\s+(?[^\.][^-\s]*)$
^upgrade.*\s+(?[^\.-\s][^\s]*)$
```
Basically adding .* means that the package name becomes the last word in the string instead of the first.
By moving the dash to the first part of the package name, it changes it from saying a package name cannot have a dash, to a package name cannot start with a dash. Also worth putting \s in there to be clear that a package cannot start with a space. This also makes a noticeable speed improvement on **choco upgrade -** as the original regex allows - as a valid package name, searches, fails and then will look for the switches.

then rinse and repeat for install, uninstall

Contributor guide

Open the contributing guide

Research direction

Locate the tab-completion regexes for upgrade, install, and uninstall, then compare them with the patterns shown in the issue. Verify completion for multiple package arguments and names containing dashes, including commands beginning with a switch; done means these cases expand without treating a leading dash as a package name.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.