RamblingCookieMonster / BuildHelpers

Helper functions for PowerShell CI/CD scenarios
MIT License
214 stars 47 forks source link

Update Set-BuildEnvironment -VariableNamePrefix validation regex #139

Closed fourpastmidnight closed 1 year ago

fourpastmidnight commented 1 year ago

The Set-BuildEnvironment's -VariableNamePrefix parameter contains a validation regex of \w*, however, _ is not one of the characters which \w matches. It would be nice to be able to specify a prefix containing an _, such as SOMEPREFIX_, so that the environment variables would be SOMEPREFIX_ModuleRoot for example. This change would go hand-in-hand with the request to make all environment variables that are created by this module upper-case, for operating systems that are case-sensitive. It is common in the Linux world to have Snake-named environment variables, i.e., name components separated by _, and all environment variables are typically upper-cased.

fourpastmidnight commented 1 year ago

It really helps when you don't have a moment of insanity and use Set-BuildEnvironment -VariableNamePrefix = 'SOMETHING_'... yeah, that doesn't work, and results in the error I got. In my moment of insanity, I somehow also forgot that _ is a character matched by the character class \w. Ugh. Closing as PBHAK.