powershell - Choice of input values for a PS function. -
i have function accepts range of input values. of times, users pick 1 of 3 values (value1, value2, value3). occasionally, might input value not in set (value 5). though, want provide user choice, avoid typos etc, don’t want restrict them 3 values. use following code, doesn’t serve purpose. suggestions?
function get-something(){ param([validateset('value1','value2','value3')] [string] $yourchoice) return $yourchoice }
one option might have 4 parameter sets, value1, value2, , value3 being switch parameters used select 1 of 3 common values, , value being string parameter used specify arbitrary value, each within it's own parameter set they're mutually exclusive.
Comments
Post a Comment