Skip to content

Commit a3c2adf

Browse files
author
Pascal Berger
committed
Throw exception if script for patching TFS task version is called with invalid arguments.
1 parent 2a6448d commit a3c2adf

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/GitVersionTfsTask/Update-GitVersionTfsTaskVersion.ps1

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,24 @@ param (
55
[string] $patch
66
)
77

8+
if ([string]::IsNullOrWhiteSpace($filePath)) {
9+
throw "File path needs to be provided."
10+
}
11+
12+
if ([string]::IsNullOrWhiteSpace($major)) {
13+
throw "Major version number needs to be provided."
14+
}
15+
16+
if ([string]::IsNullOrWhiteSpace($minor)) {
17+
throw "Minor version number needs to be provided."
18+
}
19+
20+
if ([string]::IsNullOrWhiteSpace($patch)) {
21+
throw "Patch level needs to be provided."
22+
}
23+
24+
Write-Host "Set version in '$filePath' to $major.$minor.$patch"
25+
826
# Get the task.json as a powershell object
927
$task = Get-Content -Raw -Path $filePath | ConvertFrom-Json
1028

0 commit comments

Comments
 (0)