-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCleanup-TfsConfigs.ps1
More file actions
33 lines (26 loc) · 1.02 KB
/
Cleanup-TfsConfigs.ps1
File metadata and controls
33 lines (26 loc) · 1.02 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
[CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'High' )]
param (
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[ValidateScript( {
if (-Not ($_ | Test-Path)) {
throw "Path '$_' does not exit."
}
if (($_ | Test-Path -PathType Container)) {
if (-Not ( $_ | Join-Path -ChildPath ".git" | Test-Path -PathType Container)) {
throw "Path '$_' is a valid git repository."
}
}
return $true
})]
[System.IO.FileInfo]$GitRepoDirectory
)
. .\Utils\GitTfs.ps1
Write-Host "Cleaning up TFS related configs..." -ForegroundColor White
if ($PSCmdlet.ShouldProcess("TFS configs", "delete")) {
Cleanup-GitTfs -RepoDirectory $GitRepoDirectory | Out-Null
Remove-GitTfsConfigs -RepoDirectory $GitRepoDirectory | Out-Null
Write-Host "Successfully cleaned up TFS related configs" -ForegroundColor Green
}else{
Write-Warning "Operation aborted by user."
}