Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(#2781) Add chocolateyPackageId to env variables #2900

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

steviecoaster
Copy link
Contributor

Description Of Changes

Adds a new $env:ChocolateyPackageId environment variable to the PowerShell host when installing/upgrading/uninstalling a Chocolatey package.

Motivation and Context

The nuspec references a package by id, making $env:ChocolateyPackageName less idiomatic than $env:ChocolateyPackageId. The $env:ChocolateyPackageName variable is still available for use, to prevent existing packages from breaking, but moving forward this new env variable is more inline with the nuspec definition of id.

Testing

  1. Create sample package that emits $env:ChocolateyPackageId
  2. Verifiy package id is output when installing package

Change Types Made

  • Bug fix (non-breaking change)
  • Feature / Enhancement (non-breaking change)
  • Breaking change (fix or feature that could cause existing functionality to change)
  • PowerShell code changes.

Related Issue

Fixes #2781

Change Checklist

  • Requires a change to the documentation
  • Documentation has been updated
  • Tests to cover my changes, have been added
  • All new and existing tests passed.
  • PowerShell v2 compatibility checked.

Previously the only env variable to reference a Chocolatey package id
was $env:ChocolateyPackageName. This is inconsistent with the nusepec
file where it is referenced as id.

This commit adds chocolateyPackageId and packageId to the available
environment variables available inside the PowerShell host allowing a
package maintainer to reference the id of a package with the more
idiomatic $env:ChocolateyPackageId.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

$env:ChocolateyPackageName: for consistency, it should better be named $env:ChocolateyPackageId
1 participant