1
0
Fork 0
mirror of synced 2024-12-25 08:13:20 -05:00
ultimate-vim/sources_non_forked/markdown-preview.nvim/app/install.cmd
2022-05-19 20:12:11 +08:00

29 lines
1,023 B
Batchfile
Executable file

@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.