From 336e108a834d3ef522d60678b45747d5daecd93e Mon Sep 17 00:00:00 2001 From: ruki Date: Mon, 26 Nov 2018 23:17:55 +0800 Subject: improve get.ps1 --- scripts/get.ps1 | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'scripts') diff --git a/scripts/get.ps1 b/scripts/get.ps1 index 1b798aea9..e0c61e811 100644 --- a/scripts/get.ps1 +++ b/scripts/get.ps1 @@ -2,12 +2,13 @@ # usage: (in powershell) # Invoke-Expression (Invoke-Webrequest -UseBasicParsing).Content -& { - param ( + [string]$version = "2.2.2", [string]$branch = "master" ) +& { + Function myExit($code){ if($code -is [int] -and $code -ne 0){ throw $Error[0] @@ -46,10 +47,9 @@ try{ writeErrorTip 'Please set environment var "TMP" to another path' myExit 1 } -if($ver -eq $null){ $ver='v2.2.2' } -Write-Host 'Start downloading... Hope amazon S3 is not broken again' +Write-Host "Start downloading $version... Hope amazon S3 is not broken again" try{ - Invoke-Webrequest "https://github.com/tboox/xmake/releases/download/$ver/xmake-$ver.exe" -OutFile "$outfile" + Invoke-Webrequest "https://github.com/tboox/xmake/releases/download/$version/xmake-$version.exe" -OutFile "$outfile" }catch{ writeErrorTip 'Download failed!' writeErrorTip 'Check your network or... the news of S3 break' @@ -77,7 +77,6 @@ try{ writeErrorTip 'But xmake could not run... Why?' myExit 1 } -if($branch -eq $null){ $branch='master' } Write-Host "Pulling xmake from branch $branch" $outfile=$temppath+"\$pid-xmake-repo.zip" try{ -- cgit v1.3.1