forked from pecigonzalo/Oh-My-Posh
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate.ps1
More file actions
23 lines (22 loc) · 1013 Bytes
/
update.ps1
File metadata and controls
23 lines (22 loc) · 1013 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# Go into the installation repository
# Get new code and rebase current changes
Push-Location "$Env:USERPROFILE\.oh-my-powershell"
git pull --rebase --stat origin master
if ($LASTEXITCODE) {
Pop-Location
Write-Host "Something went wrong with the git pull, unable to update" -ForegroundColor Red
exit 1
}
Pop-Location
# Copy module to the user modules folder
Write-Host "Installting Oh-My-Powershell Module"
New-Item -Type Directory "$([Environment]::GetFolderPath("mydocuments"))\WindowsPowerShell\Modules" -Force | Out-Null
Copy-Item -Recurse -Force $Env:USERPROFILE\.oh-my-powershell\modules\oh-my-powershell `
"$([Environment]::GetFolderPath("mydocuments"))\WindowsPowerShell\Modules\"
# If all good, let the user know
if ($?) {
Write-Host "Updated Oh-My-Powershell successfully!" -ForegroundColor Green
Write-Host 'PLEASE RELOAD YOUR PROFILE DOING: .$PROFILE' -ForegroundColor Green
} else {
Write-Host "Something went wrong with the update, you might need to reinstall" -ForegroundColor Red
}