-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathupdate.ps1
32 lines (30 loc) · 942 Bytes
/
update.ps1
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
# Go into the installation repository
# Get new code and rebase current changes
$INSTALL_PATH = "$HOME/.oh-my-posh"
if ($IsWindows) {
$SEPARATOR = ";"
}
else {
$SEPARATOR = ":"
}
$MODULES_PATH = "$env:PSModulePath".Split("$SEPARATOR")[0]
Push-Location "$INSTALL_PATH"
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 "Installing Oh-My-Posh Module"
Copy-Item -Recurse -Force "$INSTALL_PATH/modules/oh-my-posh" `
"$MODULES_PATH"
# If all good, let the user know
if ($?) {
Write-Host "Updated Oh-My-Posh successfully!" -ForegroundColor Green
Write-Host "PLEASE RELOAD YOUR PROFILE DOING: `n.$PROFILE" -ForegroundColor Green
}
else {
Write-Host "Something went wrong with the update, you might need to reinstall" -ForegroundColor Red
}