chocolatey / chocolatey/choco

Expand `--version` option to allow range

Open
#800 38 comments 59 reactions 0 assignees View on GitHub
0 - Backlog ClickUp - Backlog Customer Enhancement
Dominant language
C#
Stars
11.5k
Forks
960
PR merge metrics
No merged PRs in 30d

Description

#### Summary

Currently, issuing upgrades of packages restricted to a major version requires a unique id. This is typically done by appending the version to the id such as with community dotnet packages, e.g. dotnet3, dotnet4, etc.
#### Proposal

Use [nuspec versioning](https://docs.nuget.org/create/versioning) (as already used in nuspec files to determine valid dependency version) to select version with choco. This could be for install/upgrade/pin etc.

Current

```
--version=VALUE
Version - A specific version to install.
```

Proposed

```
--version=2.0, --version=[2.0]
Version - Select exact version.

--version=[1.0,2.0)
Version - Select most recent version from a range >=1.0 && <2.0

--version=(,2.0)
Version - Select most recent version from a range >0.0 && <2.0.
```

For example, if you wanted to restrict install of a package to version `9.0`
Just like when declaring a dependency in `*.nuspec`:

``` xml

```

one time use: `choco install example --version=[9.0,10.0)`
stored use (pin): `choco pin add -n=example --version [9.0,10.0)`

Adding #798 would be a very nice complement to this.

### Related

[Clickup task](https://app.clickup.com/t/20540031/PROJ-321).

┆Issue is synchronized with this [Clickup task](https://app.clickup.com/t/868jb9u22) by [Unito](https://www.unito.io)

Contributor guide

Open the contributing guide

Research direction

Start by tracing the existing `--version` handling for `install`, `upgrade`, and `pin`, then compare it with the `*.nuspec` dependency version syntax described here. Done means these commands can accept exact versions and ranges consistently, while selecting the intended package version and preserving current behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.