-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.ps1
64 lines (56 loc) · 1.7 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
## ARG
$step = $args[0].Trim("-")
if ($step -eq "help") {
Write-Host "profile > PowerShell Profile"
Write-Host "wt > Windows Terminal profile files"
Write-Host "font > FiraCode NF Font"
Write-Host "ext > PowerShell Extensions"
exit
}
elseif ($null -eq $step) {
$step = "all"
}
## DEPLOY
# set working dir
$cwd = Split-Path $MyInvocation.MyCommand.Path -Parent
Set-Location $cwd
# make sur /tmp doesnt exists
$tmp = $cwd + "/tmp/"
ri ./tmp -Force -Recurse -ErrorAction SilentlyContinue
# create /tmp
md $tmp | Out-Null
# install PS profile
if ($step -eq "all" -or $step -eq "profile") {
$target = "~/Documents/WindowsPowerShell/"
md $target -ErrorAction SilentlyContinue
$core = $cwd + "\ps\core.ps1"
(". " + $core) >> ($target + "Microsoft.PowerShell_profile.ps1")
# add vscode profile
$target += "Microsoft.VSCode_profile.ps1"
('. $' + "PSScriptRoot\Microsoft.PowerShell_profile.ps1") >> $target
('$' + "shell.Time.Enabled = " + '$' + "false") >> $target
('$' + "shell.Host.Enabled = " + '$' + "false") >> $target
('$' + "shell.Git.TrackingInfo = " + '$' + "false") >> $target
}
# install font
if ($step -eq "all" -or $step -eq "font") {
& '.\Fira Code NF.otf'
}
# install extensions
if ($step -eq "all" -or $step -eq "ext") {
if (-not(Get-InstalledModule PSBookmark -ErrorAction silentlycontinue)) {
Install-Module PSBookmark -Confirm:$False -Force
}
}
# install WT settings
if ($step -eq "all" -or $step -eq "wt") {
. ($cwd + "\ps\utils.ps1")
if (-not (Is-Defined WT-GetSettingsPath)) {
. ($cwd + "\ps\wt.ps1")
}
$target = (WT-GetPackageRoot).ToString() + "/LocalState"
$source = $cwd + "\wt\*"
Copy-Item -Force -Recurse -Path $source -Destination $target
}
# clean /tmp
ri -Force -Recurse ./tmp