@@ -11,25 +11,25 @@ $repoPath="https://github.com/$repo"
1111$rawPath = " https://raw.githubusercontent.com/$repo "
1212
1313# latest version
14- echo " Get the latest version"
14+ Write-Output " Get the latest version"
1515$releasesUri = " https://api.github.com/repos/$repo /releases/latest"
1616$tag = (Invoke-WebRequest $releasesUri | ConvertFrom-Json )[0 ].tag_name
17- echo " Latest version: $tag "
17+ Write-Output " Latest version: $tag "
1818
1919# download
20- echo " Downloading..."
20+ Write-Output " Downloading..."
2121function download_file ($name , $path ) {
22- echo " Download file $path "
22+ Write-Output " Download file $path "
2323 if ( Test-Path " $env: TEMP \$name " ) {
2424 del " $env: TEMP \$name "
2525 }
2626
2727 Invoke-WebRequest $path - Out " $env: TEMP \$name "
2828}
29- download_file cg " $rawPath /$tag /LICENSE "
29+ download_file cg " $rawPath /$tag /cg "
3030download_file cg.bat " $rawPath /$tag /cg.bat"
3131download_file cg.jar " $repoPath /releases/download/$tag /cg.jar"
32- echo " Download success."
32+ Write-Output " Download success."
3333
3434# move file
3535$cgPath = " $env: APPDATA \cg\bin"
@@ -43,7 +43,7 @@ mv "$env:TEMP\cg.bat" $cgPath
4343mv " $env: TEMP \cg.jar" $cgPath
4444
4545# set environment
46- echo " setting environment."
46+ Write-Output " setting environment."
4747$alreadyAdded = $False
4848$path = [environment ]::GetEnvironmentvariable(" PATH" , " User" )
4949$path.Split (" ;" ) | ForEach-Object - Process {if ($_ -eq $cgPath ) { $alreadyAdded = $True }}
@@ -53,5 +53,5 @@ if (! $alreadyAdded) {
5353 $path = [environment ]::SetEnvironmentvariable(" PATH" , $path , " User" )
5454}
5555
56- echo " Install success!"
56+ Write-Output " Install success!"
5757cg - v
0 commit comments