@@ -11,6 +11,31 @@ function Get-NovaReleaseRequestedPath {
1111 return (Get-Location ).Path
1212}
1313
14+ function Get-NovaReleaseBoundValueOrDefault {
15+ [CmdletBinding ()]
16+ param (
17+ [Parameter (Mandatory )][hashtable ]$BoundParameters ,
18+ [Parameter (Mandatory )][string ]$Name ,
19+ $DefaultValue = $null
20+ )
21+
22+ if ( $BoundParameters.ContainsKey ($Name )) {
23+ return $BoundParameters [$Name ]
24+ }
25+
26+ return $DefaultValue
27+ }
28+
29+ function Test-NovaReleaseBoundSwitch {
30+ [CmdletBinding ()]
31+ param (
32+ [Parameter (Mandatory )][hashtable ]$BoundParameters ,
33+ [Parameter (Mandatory )][string ]$Name
34+ )
35+
36+ return $BoundParameters.ContainsKey ($Name ) -and [bool ]$BoundParameters [$Name ]
37+ }
38+
1439function Get-NovaReleaseRequest {
1540 [CmdletBinding ()]
1641 param (
@@ -20,33 +45,13 @@ function Get-NovaReleaseRequest {
2045
2146 return [pscustomobject ]@ {
2247 ParameterSetName = $ParameterSetName
23- PublishOption = if ( $BoundParameters.ContainsKey (' PublishOption' )) {
24- $BoundParameters.PublishOption
25- }
26- else {
27- @ {}
28- }
29- LocalRequested = $BoundParameters.ContainsKey (' Local' ) -and [bool ]$BoundParameters.Local
30- Repository = if ( $BoundParameters.ContainsKey (' Repository' )) {
31- $BoundParameters.Repository
32- }
33- else {
34- $null
35- }
36- ModuleDirectoryPath = if ( $BoundParameters.ContainsKey (' ModuleDirectoryPath' )) {
37- $BoundParameters.ModuleDirectoryPath
38- }
39- else {
40- $null
41- }
42- ApiKey = if ( $BoundParameters.ContainsKey (' ApiKey' )) {
43- $BoundParameters.ApiKey
44- }
45- else {
46- $null
47- }
48- SkipTestsRequested = $BoundParameters.ContainsKey (' SkipTests' ) -and $BoundParameters.SkipTests
49- ContinuousIntegrationRequested = $BoundParameters.ContainsKey (' ContinuousIntegration' ) -and $BoundParameters.ContinuousIntegration
50- OverrideWarningRequested = $BoundParameters.ContainsKey (' OverrideWarning' ) -and $BoundParameters.OverrideWarning
48+ PublishOption = Get-NovaReleaseBoundValueOrDefault - BoundParameters $BoundParameters - Name ' PublishOption' - DefaultValue @ {}
49+ LocalRequested = Test-NovaReleaseBoundSwitch - BoundParameters $BoundParameters - Name ' Local'
50+ Repository = Get-NovaReleaseBoundValueOrDefault - BoundParameters $BoundParameters - Name ' Repository'
51+ ModuleDirectoryPath = Get-NovaReleaseBoundValueOrDefault - BoundParameters $BoundParameters - Name ' ModuleDirectoryPath'
52+ ApiKey = Get-NovaReleaseBoundValueOrDefault - BoundParameters $BoundParameters - Name ' ApiKey'
53+ SkipTestsRequested = Test-NovaReleaseBoundSwitch - BoundParameters $BoundParameters - Name ' SkipTests'
54+ ContinuousIntegrationRequested = Test-NovaReleaseBoundSwitch - BoundParameters $BoundParameters - Name ' ContinuousIntegration'
55+ OverrideWarningRequested = Test-NovaReleaseBoundSwitch - BoundParameters $BoundParameters - Name ' OverrideWarning'
5156 }
5257}
0 commit comments