The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 4,269 other subscribers

I missed that the `choco list –localonly` had become default in 2015…

Posted by jpluimers on 2023/07/28

and when upgrading to Chocolatey to version 2, I got this error:

Invalid argument --localonly. This argument has been removed from the list command and cannot be used.

The upgrade broke a small batch file choco-list-installed.bat that I run on a lot of systems including both old and new chocolatey installations some dating back to before 2015 having this simple content:

choco list --localonly

So I missed [Wayback/Archive] Change behavior of choco list to be local only · Issue #158 · chocolatey/choco which had been enforced in 2.0.0 or 2.0.1 to error out with the above message according to the [Wayback/Archive] Chocolatey Software Docs | Upgrading To Chocolatey Products v2.0.0 and Chocolatey Licensed Extension 6.0.0: the –local-only and -lo Options Have Been Removed.

However, it also introduces the workaround making it forward compatible for integrations (like batch file scripts) that need to run on both Chocolatey v1 and v2:

To ensure we do not break any existing automation, integrations or scripts using the --limit-output or -r along with -l-a or one of their aliases, will continue to run and will not produce an error. Only a warning will be added to the logs. In a future release this will produce an error, so please ensure you remove -l-a, and aliases, from any automations or scripts that you have.

So now my batch file is this and compatible with both Chocolatey versions 1 and 2:

choco list --local-only --limit-output

Query: [Wayback/Archive] “Invalid argument –localonly. This argument has been removed from the list command and cannot be used.” – Google Search

–jeroen

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.