forked from neoclide/coc.nvim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.cmd
35 lines (25 loc) · 1.05 KB
/
install.cmd
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
@PowerShell -ExecutionPolicy Bypass -Command Invoke-Expression $('$args=@(^&{$args} %*);'+[String]::Join(';',(Get-Content '%~f0') -notmatch '^^@PowerShell.*EOF$')) & goto :EOF
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$ErrorActionPreference = "Stop"
$repo = "neoclide/coc.nvim"
$file = "coc-win.zip"
$releases = "https://api.github.com/repos/$repo/releases"
Write-Host Determining latest release
if ($args[0]) { $tag = $args[0] } else { $tag = (Invoke-WebRequest $releases | ConvertFrom-Json)[0].tag_name }
$download = "https://github.com/$repo/releases/download/$tag/$file"
$name = $file.Split(".")[0]
$zip = "$name-$tag.zip"
$dir = "build"
new-item -Name $dir -ItemType directory -Force
Write-Host Dowloading latest release
Invoke-WebRequest $download -Out $zip
try {
taskkill /F /Im coc-win.exe
} catch {
Write-Host coc process not running
}
Remove-Item $dir\* -Recurse -Force
Write-Host Extracting release files
Expand-Archive $zip -DestinationPath $dir -Force
Remove-Item $zip -Force
Write-Host Coc install completed.