@@ -11,25 +11,25 @@ $repoPath="https://github.com/$repo"
11
11
$rawPath = " https://raw.githubusercontent.com/$repo "
12
12
13
13
# latest version
14
- echo " Get the latest version"
14
+ Write-Output " Get the latest version"
15
15
$releasesUri = " https://api.github.com/repos/$repo /releases/latest"
16
16
$tag = (Invoke-WebRequest $releasesUri | ConvertFrom-Json )[0 ].tag_name
17
- echo " Latest version: $tag "
17
+ Write-Output " Latest version: $tag "
18
18
19
19
# download
20
- echo " Downloading..."
20
+ Write-Output " Downloading..."
21
21
function download_file ($name , $path ) {
22
- echo " Download file $path "
22
+ Write-Output " Download file $path "
23
23
if ( Test-Path " $env: TEMP \$name " ) {
24
24
del " $env: TEMP \$name "
25
25
}
26
26
27
27
Invoke-WebRequest $path - Out " $env: TEMP \$name "
28
28
}
29
- download_file cg " $rawPath /$tag /LICENSE "
29
+ download_file cg " $rawPath /$tag /cg "
30
30
download_file cg.bat " $rawPath /$tag /cg.bat"
31
31
download_file cg.jar " $repoPath /releases/download/$tag /cg.jar"
32
- echo " Download success."
32
+ Write-Output " Download success."
33
33
34
34
# move file
35
35
$cgPath = " $env: APPDATA \cg\bin"
@@ -43,7 +43,7 @@ mv "$env:TEMP\cg.bat" $cgPath
43
43
mv " $env: TEMP \cg.jar" $cgPath
44
44
45
45
# set environment
46
- echo " setting environment."
46
+ Write-Output " setting environment."
47
47
$alreadyAdded = $False
48
48
$path = [environment ]::GetEnvironmentvariable(" PATH" , " User" )
49
49
$path.Split (" ;" ) | ForEach-Object - Process {if ($_ -eq $cgPath ) { $alreadyAdded = $True }}
@@ -53,5 +53,5 @@ if (! $alreadyAdded) {
53
53
$path = [environment ]::SetEnvironmentvariable(" PATH" , $path , " User" )
54
54
}
55
55
56
- echo " Install success!"
56
+ Write-Output " Install success!"
57
57
cg - v
0 commit comments