Skip to content

Commit 666a12a

Browse files
author
Friedrich Weinmann
committed
strings: Adding support for Test-PSFShouldProcess
1 parent a8973a8 commit 666a12a

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

PSModuleDevelopment/changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## ???
44

55
- New: Convert-PSMDMessage - Converts a file's use of PSFramework messages to strings.
6+
- Upd: Export-PSMDString - Adding support for Test-PSFShouldProcess.
67
- Fix: Export-PSMDString - Failed with splatting detection
78

89
## 2.2.8.104 (July 26th, 2020)

PSModuleDevelopment/functions/refactor/Convert-PSMDMessage.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@
125125

126126
$commandAsts = $ast.FindAll({
127127
if ($args[0] -isnot [System.Management.Automation.Language.CommandAst]) { return $false }
128-
if ($args[0].CommandElements[0].Value -notmatch '^Invoke-PSFProtectedCommand$|^Write-PSFMessage$|^Stop-PSFFunction$') { return $false }
128+
if ($args[0].CommandElements[0].Value -notmatch '^Invoke-PSFProtectedCommand$|^Write-PSFMessage$|^Stop-PSFFunction$|^Test-PSFShouldProcess$') { return $false }
129129
if (-not ($args[0].CommandElements.ParameterName -match '^Message$|^Action$')) { return $false }
130130
$true
131131
}, $true)

PSModuleDevelopment/functions/refactor/Export-PSMDString.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
#region Command Parameters
4949
$commandAsts = $ast.FindAll({
5050
if ($args[0] -isnot [System.Management.Automation.Language.CommandAst]) { return $false }
51-
if ($args[0].CommandElements[0].Value -notmatch '^Invoke-PSFProtectedCommand$|^Write-PSFMessage$|^Stop-PSFFunction$') { return $false }
51+
if ($args[0].CommandElements[0].Value -notmatch '^Invoke-PSFProtectedCommand$|^Write-PSFMessage$|^Stop-PSFFunction$|^Test-PSFShouldProcess$') { return $false }
5252
if (-not ($args[0].CommandElements.ParameterName -match '^String$|^ActionString$')) { return $false }
5353
$true
5454
}, $true)
@@ -79,7 +79,7 @@
7979
$splattedVariables = $ast.FindAll({
8080
if ($args[0] -isnot [System.Management.Automation.Language.VariableExpressionAst]) { return $false }
8181
if (-not ($args[0].Splatted -eq $true)) { return $false }
82-
try { if ($args[0].Parent.CommandElements[0].Value -notmatch '^Invoke-PSFProtectedCommand$|^Write-PSFMessage$|^Stop-PSFFunction$') { return $false } }
82+
try { if ($args[0].Parent.CommandElements[0].Value -notmatch '^Invoke-PSFProtectedCommand$|^Write-PSFMessage$|^Stop-PSFFunction$|^Test-PSFShouldProcess$') { return $false } }
8383
catch { return $false }
8484
$true
8585
}, $true)

0 commit comments

Comments
 (0)