-
-
Notifications
You must be signed in to change notification settings - Fork 1
feat(Resolve-ProjectParameters): Remove sticky project environment setting #199
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
Changes from all commits
1fe867e
9199c63
e7c3023
f4bed35
cb75e1f
c66700b
042a590
7f00ea0
ce57b6d
e50cbd2
5ff09d5
a22adb0
5aafd9d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| function Resolve-ProjectParameters { | ||
Check warningCode scanning / PSScriptAnalyzer The cmdlet 'Resolve-ProjectParameters' uses a plural noun. A singular noun should be used instead. Warning
The cmdlet 'Resolve-ProjectParameters' uses a plural noun. A singular noun should be used instead.
|
||
| [CmdletBinding()] | ||
| param( | ||
| [Parameter(Position = 0)][string]$ProjectNumber, | ||
| [Parameter(Position = 1)][string]$Owner, | ||
| [Parameter()][switch]$DoNotThrow | ||
|
|
||
| ) | ||
|
|
||
| if($ProjectNumber -eq 0){ | ||
| $ProjectNumber = "" | ||
| } | ||
|
|
||
| if([string]::IsNullOrWhiteSpace($Owner)){ | ||
| $Owner = Get-EnvItem -Name "EnvironmentCache_Owner" | ||
| } | ||
|
|
||
| if([string]::IsNullOrWhiteSpace($ProjectNumber)){ | ||
| $ProjectNumber = Get-EnvItem -Name "EnvironmentCache_ProjectNumber" | ||
| } | ||
|
|
||
| if([string]::IsNullOrWhiteSpace($ProjectNumber) -or [string]::IsNullOrWhiteSpace($Owner)){ | ||
| if(-Not $DoNotThrow){ | ||
| throw "Owner and ProjectNumber parameters are required. Please provide them as parameters or set them in the environment cache." | ||
| } else { | ||
| Write-MyDebug "Owner or ProjectNumber is missing. Returning null values." -Section "Resolve-ProjectParameters" | ||
| return ($null, $null) | ||
| } | ||
| } | ||
|
|
||
| return ($Owner, $ProjectNumber) | ||
| } | ||
|
|
||
| function Test-ProjectParameters { | ||
Check warningCode scanning / PSScriptAnalyzer The cmdlet 'Test-ProjectParameters' uses a plural noun. A singular noun should be used instead. Warning
The cmdlet 'Test-ProjectParameters' uses a plural noun. A singular noun should be used instead.
|
||
| [CmdletBinding()] | ||
| param( | ||
| [Parameter(Position = 0)][string]$ProjectNumber, | ||
| [Parameter(Position = 1)][string]$Owner | ||
| ) | ||
|
|
||
| ($Owner, $ProjectNumber) = Resolve-ProjectParameters -Owner $Owner -ProjectNumber $ProjectNumber -DoNotThrow | ||
|
|
||
| return -not ([string]::IsNullOrWhiteSpace($Owner) -or [string]::IsNullOrWhiteSpace($ProjectNumber)) | ||
Check noticeCode scanning / PSScriptAnalyzer The cmdlet 'Test-ProjectParameters' returns an object of type 'System.Boolean' but this type is not declared in the OutputType attribute. Note
The cmdlet 'Test-ProjectParameters' returns an object of type 'System.Boolean' but this type is not declared in the OutputType attribute.
|
||
| } | ||
|
|
||
| function Set-ProjectParameters { | ||
Check warningCode scanning / PSScriptAnalyzer Function 'Set-ProjectParameters' has verb that could change system state. Therefore, the function has to support 'ShouldProcess'. Warning
Function 'Set-ProjectParameters' has verb that could change system state. Therefore, the function has to support 'ShouldProcess'.
Check warningCode scanning / PSScriptAnalyzer The cmdlet 'Set-ProjectParameters' uses a plural noun. A singular noun should be used instead. Warning
The cmdlet 'Set-ProjectParameters' uses a plural noun. A singular noun should be used instead.
Check noticeCode scanning / PSScriptAnalyzer The cmdlet 'Set-ProjectParameters' does not have a help comment. Note
The cmdlet 'Set-ProjectParameters' does not have a help comment.
|
||
| [CmdletBinding()] | ||
| [Alias("Set-Project")] | ||
| param( | ||
| [Parameter(Mandatory,ValueFromPipelineByPropertyName, Position = 0)][string]$Owner, | ||
| [Parameter(Mandatory,ValueFromPipelineByPropertyName, Position = 1)][string]$ProjectNumber | ||
| ) | ||
|
|
||
| process { | ||
|
|
||
| Set-ProjectHelperEnvironment -Owner $Owner -ProjectNumber $ProjectNumber | ||
| } | ||
|
|
||
| } Export-ModuleMember -Function Set-ProjectParameters -Alias "Set-Project" | ||
Check notice
Code scanning / PSScriptAnalyzer
Line has trailing whitespace Note