forked from ajgorhoe/IGLib.modules.IGLibCore
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestScript.ps1
More file actions
50 lines (34 loc) · 1 KB
/
Copy pathTestScript.ps1
File metadata and controls
50 lines (34 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# Run: .\TestScript.ps1 -RepoDirs @("ab", "cd") -Sw
# This is for testing transferring parameters and switches to called scripts.
# REMOVE when not needed any more.
[CmdletBinding()]
param(
[string[]] $RepoDirs = @(),
[switch]$Sw
)
Write-Host "`n`nScript TestScript was called."
Write-Host "`nThis tests transfer of parameters to called scripts."
Write-Host ("`nRepoDirs: `n{0}" -f ($RepoDirs -join ", `n"))
if ($Sw) {
Write-Host "Switch is set."
}
if (-not $Sw) {
Write-Host "Switch is NOT set."
}
if ($Sw.IsPresent) {
Write-Host "Switch is set, tested via IsPresent."
}
if (-not $Sw.IsPresent) {
Write-Host "Switch is NOT set, tested via IsPresent."
}
[bool]$b = $Sw
Write-Host "Sw assigned to bool b: $b "
[bool] $a = $Sw.IsPresent
Write-Host "Sw.IsPresent assigned to bool a: $a "
Write-Host "Sw: $Sw "
Write-Host "Sv.IsPresent: $Sv.IsPresent "
if ($Sw) {
Write-Host "`n`nSwitch is set, Running TestScript again with switch not set..."
./TestScript.ps1 -Sw:$(-not $Sw)
}
Write-Host "`n"