Skip to content

Commit ed64530

Browse files
More refactoring
1 parent 0471c51 commit ed64530

File tree

3 files changed

+10
-12
lines changed

3 files changed

+10
-12
lines changed

PSModuleDevelopment/changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- Upd: Refactored and updated the ModuleDebug component
66
- Upd: Renamed Get-PSMDHelpEx to Get-PSMDHelp
77
- Upd: Template PSFProject - Adding `-IncludAZ` switch parameter to `vsts-packageFunction.ps1`, making the template include the AZ module as managed dependency.
8+
- Upd: Template PSFProject - yaml file for AzDev PR validation pipeline
89
- Upd: Refactored module structure to comply with current Fred Reference Architecture
910
- Upd: Template PSFTests - Added localization string tests
1011
- Upd: Remove-PSMDTemplate - Refactored and updated messaging / ShouldProcess implementation

PSModuleDevelopment/functions/utility/Show-PSMDSyntax.ps1

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
#Match to find the command name: Non-Whitespace until the first whitespace
7676
$commandMatch = ($CommandText | Select-String '\S+\s*').Matches
7777

78-
if ($null -eq $commandMatch)
78+
if (-not $commandMatch)
7979
{
8080
Write-PSFMessage -Level Host -Message "The function was unable to extract a valid command name from the supplied command text. Please try again."
8181
Stop-PSFFunction -Message "Stopping because of missing command name."
@@ -86,7 +86,7 @@
8686

8787
$res = Get-Command $commandName -ErrorAction Ignore
8888

89-
if ($null -eq $res)
89+
if (-not $res)
9090
{
9191
Write-PSFMessage -Level Host -Message "The function was unable to get the help of the command. Make sure that the command name is valid and try again."
9292
Stop-PSFFunction -Message "Stopping because command name didn't return any help."
@@ -96,13 +96,18 @@
9696
$sbHelp = New-Object System.Text.StringBuilder
9797
$sbParmsNotFound = New-Object System.Text.StringBuilder
9898

99+
if (-not ($CommandText | Select-String '\s{1}[-]\S+' -AllMatches).Matches)
100+
{
101+
$Mode = 'ShowParameters'
102+
}
103+
99104
switch ($Mode)
100105
{
101106
"Validate" {
102-
#Match to find the parameters: Whitespace Dash Non-Whitespace
107+
# Match to find the parameters: Whitespace Dash Non-Whitespace
103108
$inputParameterMatch = ($CommandText | Select-String '\s{1}[-]\S+' -AllMatches).Matches
104109

105-
if (-not ($null -eq $inputParameterMatch))
110+
if ($inputParameterMatch)
106111
{
107112
$inputParameterNames = $inputParameterMatch.Value.Trim("-", " ")
108113
Write-PSFMessage -Level Verbose -Message "All input parameters - $($inputParameterNames -join ",")" -Target ($inputParameterNames -join ",")

PSModuleDevelopment/internal/functions/template/Get-PsmdTemplateStore.ps1

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,6 @@
2828
$Filter = "*"
2929
)
3030

31-
begin
32-
{
33-
34-
}
3531
process
3632
{
3733
Get-PSFConfig -FullName "PSModuleDevelopment.Template.Store.$Filter" | ForEach-Object {
@@ -41,8 +37,4 @@
4137
}
4238
}
4339
}
44-
end
45-
{
46-
47-
}
4840
}

0 commit comments

Comments
 (0)