chocolatey / cChoco

Community resource to manage Chocolatey
Apache License 2.0
154 stars 99 forks source link

Implementation of Get-ChocoInstalledPackage fails when using Chocolatey as a package #87

Closed lukegriffith closed 7 years ago

lukegriffith commented 7 years ago

The current used implementation considers the choco version banner to be a package, and returns with a version "vX.X.X", if chocolatey is installed via the choco package the list has duplicates, and the presence of the string v causes the where clause, converting the string to a version to fail.

Moving to using the -r argument, and converting from a CSV will resolve these problems, only consideration is how backwards compatible is -r?

Potential simpler implementation.

function Get-ChocoInstalledPackage {

    Return (Choco list -r -l | ConvertFrom-Csv -Header "Name", "Version" -Delimiter "|")
}
ferventcoder commented 7 years ago

-r or limit output has been available since 0.9.9 (almost 2.5 years now), so there shouldn't be a concern for compat. It should be using -r. Most things for cChoco are going to come up to be more like what you see in the Puppet provider.

ferventcoder commented 7 years ago

Is this a gating issue for you currently?

lukegriffith commented 7 years ago

Not currently, we've forked the hell out of this resource I won't lie. I've fixed our implementation just being a good citizen.

ferventcoder commented 7 years ago

@lukemgriffith 👍

If it's allowed, we'd love to get some of those fixes into here...

lukegriffith commented 7 years ago

submitted PR for this. https://github.com/chocolatey/cChoco/pull/88