forked from pecigonzalo/Oh-My-Posh
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.ps1
43 lines (39 loc) · 1.23 KB
/
install.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
33
34
35
36
37
38
39
40
41
42
43
param (
[bool]$local = $false,
[bool]$force = $false
)
# Load utils
. ./tools/utils.ps1
function Install-OMP {
Check-Recommends
Check-Dependencies
Write-Output "Deleting $Env:USERPROFILE\.oh-my-posh"
Remove-Item -Force -Recurse "$Env:USERPROFILE\.oh-my-posh" -ErrorAction SilentlyContinue
if ($local) {
# Deploy from current folder
Write-Output "Coping Oh-My-Posh to its destination"
Copy-Item -Recurse -Force .\ "$Env:USERPROFILE\.oh-my-posh\"
} else {
# Clone project
Write-Output "Cloning Oh-My-Posh from Github"
git clone https://github.com/pecigonzalo/Oh-My-Posh.git $Env:USERPROFILE\.oh-my-posh
}
# Copy module to the user modules folder
Write-Output "Installting Oh-My-Posh Module"
New-Item -Type Directory "$([Environment]::GetFolderPath("mydocuments"))\WindowsPowerShell\Modules" -Force | Out-Null
Copy-Item -Recurse -Force $Env:USERPROFILE\.oh-my-posh\modules\oh-my-posh `
"$([Environment]::GetFolderPath("mydocuments"))\WindowsPowerShell\Modules\"
}
#
# Install logic
#
if ( Test-Path $Env:USERPROFILE\.oh-my-posh ) {
Write-Output "Oh-My-Posh is already installed"
if ( $force -eq $true ) {
Write-Output "Reinstalling Oh-My-Posh"
Install-OMP
}
} else {
Install-OMP
}
.$PROFILE