summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorruki <[email protected]>2018-11-26 23:17:55 +0800
committerruki <[email protected]>2018-11-26 13:47:32 +0800
commit336e108a834d3ef522d60678b45747d5daecd93e (patch)
tree1daedbd50d86bf20437b2a4c1cd25843e1aab2e2 /scripts
parent8685836a86a54049f6202a03d173cd32f4c9c23a (diff)
improve get.ps1
Diffstat (limited to 'scripts')
-rw-r--r--scripts/get.ps111
1 files changed, 5 insertions, 6 deletions
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 <my location> -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{