-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathuninstall.ps1
18 lines (15 loc) · 957 Bytes
/
uninstall.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
$scriptDirectory = Split-Path $MyInvocation.MyCommand.Path -Parent
Import-Module "$scriptDirectory\GitStatusCachePoshClient.psm1"
Remove-GitStatusCache
Remove-Module "GitStatusCachePoshClient"
if((Test-Path $PROFILE) -and ((Get-Content $profile) -ne $null))
{
Write-Host -ForegroundColor Green 'Removing git-status-cache-posh-client from $PROFILE.'
$firstProfileLine = '# Import git-status-cache-posh-client'
$secondProfileLine = [RegEx]::Escape("Import-Module '$scriptDirectory\GitStatusCachePoshClient.psm1'")
Get-Content $profile | Where-Object { ($_ -notmatch $firstProfileLine) -and ($_ -notmatch $secondProfileLine) } | Set-Content "$profile.temp"
Move-Item "$profile.temp" $profile -Force
}
Write-Host -ForegroundColor Green 'Removed git-status-cache-posh-client.'
Write-Host -ForegroundColor Green 'Please reload your profile for the changes to take effect:'
Write-Host -ForegroundColor Green ' . $PROFILE'