You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The [ValidateSet] + string approach is certainly not ideal.
But if you use [nullable[bool]], you can't provide a string literal, e.g.
<CmdLet>-BooleanProperty false
results in ⬇️
Cannot convert value "System.String" to type "System.Nullable`1[System.Boolean]".
Boolean parameters accept only Boolean values and numbers, such as $True, $False, 1 or 0.
Seems like an oversight in Powershell; if you're going to say integers are valid, why not (unambiguous) strings?
indeed -- I like supporting string literals as often the cmdlets are invoked from CI jobs. in some cases, the fact that the underlying code is powershell is completely hidden
[bool]
has some annoying behaviors, e.g. you can't pass bare stringstrue
orfalse
Using this pattern makes consumption easier
The text was updated successfully, but these errors were encountered: