Winget-cli: Support separator to define specific version

Created on 6 Jun 2020  Â·  6Comments  Â·  Source: microsoft/winget-cli

Description of the new feature/enhancement

Support a separator for package name, e.g. winget install "package@version", in addition/instead of --version.

The reasoning is simple, passing the @version in a list of packages to install is much easier, than a separate --version argument.

I've got scripts I use to install various packages from Chocolatey, Scoop, and now WinGet, and I'd like to specifically install Node.js 12, so I need to specify the version as the default is 14. In this long list of packages I'd rather not specify the version for most things, and I'd like to see a familiar means of defining versions of packages.

There are some possible variants, incl ==.

E.g.:

winget install "[email protected]"
winget install "Node.js==12.16.3"

The advantage of == is that you could use >, <, >=, <= as well in the future, so winget install "Node.js<13.0.0" would install the latest 12.x.x release, and so on.

Issue-Feature

Most helpful comment

>, >=, ==, <=, < would be greatly preferable to * because

1) it's simply more common
2) more importantly, it's also much more powerful, especially when able to chain, and use in defining dependencies
3) in the future when you extend it with | -rules as well it will be really good

E.g. I would want to install foo>=12, latest 12.1.2 fulfills that, it depends on bar>=3,<3.8 so foo==12.1.2 and bar==3.7.x get installed, even though bar==3.8.0 exists as well.

More common case would though be bar>=3,<4, but e.g. in case of Python I've often seen >=2.7,<3|>=3.4 or so, as Python versions 3.0-3.3 were considered pretty bad for compatibility with 2.7

All 6 comments

I agree and also suggested this in another issue

We've been considering wild card syntax options and operands for this scenario.

winget install foo -v 12.* would install the latest 12.x.x release.

In terms of installing a set of apps, we're looking at a single file that would handle various scenarios for supporting the installation of specific versions of apps, or latest, or what ever the user would like.

>, >=, ==, <=, < would be greatly preferable to * because

1) it's simply more common
2) more importantly, it's also much more powerful, especially when able to chain, and use in defining dependencies
3) in the future when you extend it with | -rules as well it will be really good

E.g. I would want to install foo>=12, latest 12.1.2 fulfills that, it depends on bar>=3,<3.8 so foo==12.1.2 and bar==3.7.x get installed, even though bar==3.8.0 exists as well.

More common case would though be bar>=3,<4, but e.g. in case of Python I've often seen >=2.7,<3|>=3.4 or so, as Python versions 3.0-3.3 were considered pretty bad for compatibility with 2.7

On a related note, it would be nice if winget search could list available versions, perhaps with an optional version spec like those being discussed here. This way we can see what versions are available.

It's common for package managers to have "search" to list what packages are available and then "info" / "show" commands to show details of that, as you require descriptions, authors, etc. anyway, that can then show the list of available versions

The latest version is often shown, as with all these mature package managers:

> choco search foo
Chocolatey v0.10.15
foobar2000 1.5.5 [Approved]
freeencoderpack 2020.07.11 [Approved]
ipinfooffline 1.50 [Approved] Downloads cached for licensed users - Possibly broken for FOSS users (due to original download location changes by vendor)
3 packages found.

> nuget list foo
HashFoo.MigratorFoo 0.5.4623.19419
HashFoo.Nhib 0.5.4623.20866
HashFoo.Nhib.Spatial 0.5.4623.20850
...

> npm find foo
NAME                      | DESCRIPTION          | AUTHOR          | DATE       | VERSION  | KEYWORDS
foo                       | An opinionated git…  | =bomsy…         | 2017-11-01 | 0.0.7    |         
camelcase                 | Convert a…           | =sindresorhus   | 2020-04-07 | 6.0.0    | camelcase camel-case camel case dash hyphen dot underscore separator string text convert pascalcase pascal-case
@foo-software/react-scrol | A React scroll…      | =adamhenson     | 2020-01-11 | 0.0.27   | component context foo handler react react context provider scroll scroll context scroll handler scroll provider www.foo.software
...

> apt search foo
Sorting... Done
Full Text Search... Done
blosxom/bionic 2.1.2-2 all
  light, feature-packed weblog app with plugin extensibility

bowtie/bionic 1.2.2+dfsg-2 amd64
  Ultrafast memory-efficient short read aligner

bowtie-examples/bionic 1.2.2+dfsg-2 all
  Examples for bowtie, the ultrafast memory-efficient short read aligner
...

> pip3 search foo
gym-foo (0.1)                 - GCPDS: gym-foo
liuyix-foo (0.1)              - foo package test
foo-eric-test (1.6.1)         - funny foo
...
Was this page helpful?
0 / 5 - 0 ratings