-
Notifications
You must be signed in to change notification settings - Fork 0
/
install-scripts.ps1
25 lines (24 loc) · 960 Bytes
/
install-scripts.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
$clink = "${env:ProgramFiles(x86)}\clink\clink_x64.exe"
if (!(Test-Path $clink)) {
$clinkCmd = Get-Command clink
if ($clinkCmd) {
$clink = $clinkCmd.Source
} else {
Write-Error "clink not found"
exit 1
}
}
$scripts = $(. $clink installscripts --list)
function Add-Script([string] $scriptPath) {
if ("$scripts" -notlike "*$scriptPath*") {
Write-Output "Adding $scriptPath to clink scripts..."
. $clink installscripts $scriptPath
}
}
Add-Script (Join-Path $PSScriptRoot "clink-completions")
Add-Script (Join-Path $PSScriptRoot "clink-fzf")
if (!(Test-Path (Join-Path $PSScriptRoot "z.cmd"))) {
Write-Output "Downloading z files..."
Invoke-RestMethod https://raw.githubusercontent.com/skywind3000/z.lua/master/z.cmd -OutFile (Join-Path $PSScriptRoot "z.cmd")
Invoke-RestMethod https://raw.githubusercontent.com/skywind3000/z.lua/master/z.lua -OutFile (Join-Path $PSScriptRoot "z.lua")
}