summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorruki <[email protected]>2023-02-21 17:26:22 +0800
committerGitHub <[email protected]>2023-02-21 17:26:22 +0800
commit182613fd26ca880aa925fc02541cbf7f51104dd4 (patch)
treec17c119f474a19293842e17219f0c36dfdc4d12d /scripts
parent9c18941b2853e244a03f3a75aacca57f36b4ebb8 (diff)
parent12747a1ea9e85ba231111753090992eb7d95fa53 (diff)
Merge pull request #3403 from OpportunityLiu/patch-1
Fix ps1 install script
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/get.ps112
1 files changed, 10 insertions, 2 deletions
diff --git a/scripts/get.ps1 b/scripts/get.ps1
index 5c00ff1fe..d117bfc45 100755
--- a/scripts/get.ps1
+++ b/scripts/get.ps1
@@ -148,10 +148,18 @@ param (
}
if ($content) {
- $content = [System.Text.RegularExpressions.Regex]::Replace($content, "\n*(# PowerShell parameter completion shim for xmake)?\s*Register-ArgumentCompleter -Native -CommandName xmake -ScriptBlock\s*{.+?\n}\s*", "`n", [System.Text.RegularExpressions.RegexOptions]::Singleline)
+ $content = $content -replace "`n# >>> xmake >>>`n[\S\s]*?`n# <<< xmake <<<`n", ""
}
try {
- $appendcontent = (Invoke-Webrequest 'https://xmake.io/assets/scripts/pscompletions.text' -UseBasicParsing).Content
+ $url = if ($v -is [version]) {
+ "https://fastly.jsdelivr.net/gh/xmake-io/xmake@v$v/scripts/register-completions.ps1"
+ } else {
+ "https://fastly.jsdelivr.net/gh/xmake-io/xmake@$v/scripts/register-completions.ps1"
+ }
+ $appendcontent = (Invoke-Webrequest $url -UseBasicParsing).Content
+ if ($appendcontent -is [byte[]]) {
+ $appendcontent = [System.Text.Encoding]::UTF8.GetString($appendcontent)
+ }
} catch {
writeErrorTip 'Download failed!'
writeErrorTip 'Check your network or... the news of S3 break'