-
-
Notifications
You must be signed in to change notification settings - Fork 284
/
install.cmd
executable file
·29 lines (19 loc) · 1023 Bytes
/
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
@PowerShell -ExecutionPolicy Bypass -Command Invoke-Expression $('$args=@(^&{$args} %*);'+[String]::Join(';',(Get-Content '%~f0') -notmatch '^^@PowerShell.*EOF$')) & goto :EOF
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$repo = "iamcco/markdown-preview.nvim"
$file = "markdown-preview-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 = "bin"
new-item -Name $dir -ItemType directory -Force
Write-Host Dowloading latest release
Invoke-WebRequest $download -Out $zip
Remove-Item $dir\* -Recurse -Force -ErrorAction SilentlyContinue
Write-Host Extracting release files
Expand-Archive $zip -DestinationPath $dir -Force
Remove-Item $zip -Force
Write-Host markdown-preview install completed.