Skip to content

Commit aaf2a38

Browse files
authored
Merge pull request #70 from codecrafters-io/andy/update-install-ps1
Update install.ps1 to match the new style of install.sh
2 parents 2e5556f + 6d57f4b commit aaf2a38

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

install.ps1

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,21 @@ $InstallPath = if ($env:INSTALL_PATH) { $env:INSTALL_PATH } else { "$InstallDir\
2020

2121
$DownloadUrl = "https://github.com/codecrafters-io/cli/releases/download/$Version/${Version}_windows_$Arch.tar.gz"
2222

23-
Write-Host "This script will automatically install codecrafters ($Version) for you."
24-
Write-Host "Installation path: $InstallPath"
23+
Write-Host "Downloading " -NoNewline
24+
Write-Host "CodeCrafters CLI " -ForegroundColor Green -NoNewline
25+
Write-Host "($Version)" -ForegroundColor DarkGray -NoNewline
26+
Write-Host "..."
2527

2628
$TempDir = Join-Path $env:TEMP "codecrafters-install-$([System.Guid]::NewGuid().ToString('N'))"
2729
New-Item -ItemType Directory -Path $TempDir -Force | Out-Null
2830

2931
try {
3032
$TarGzPath = Join-Path $TempDir "codecrafters.tar.gz"
31-
Write-Host "Downloading CodeCrafters CLI..."
3233

3334
try {
3435
Invoke-WebRequest -Uri $DownloadUrl -OutFile $TarGzPath -UseBasicParsing
3536
} catch {
36-
Write-Error "Failed to download. Your platform and architecture (windows-$Arch) may be unsupported."
37+
Write-Host "error: your platform and architecture (windows-$Arch) is unsupported."
3738
exit 1
3839
}
3940

@@ -47,15 +48,18 @@ try {
4748
Move-Item -Path $ExtractedBinary -Destination $InstallPath -Force
4849

4950
$InstalledVersion = & $InstallPath --version
50-
Write-Host "Installed $InstalledVersion"
5151

5252
$UserPath = [Environment]::GetEnvironmentVariable("Path", "User")
5353
if ($UserPath -notlike "*$InstallDir*") {
5454
$NewUserPath = if ($UserPath) { "$UserPath;$InstallDir" } else { $InstallDir }
5555
[Environment]::SetEnvironmentVariable("Path", $NewUserPath, "User")
5656
$env:Path += ";$InstallDir"
5757
}
58-
Write-Host "Done!"
58+
59+
Write-Host ([char]0x2713) -ForegroundColor Green -NoNewline
60+
Write-Host " CodeCrafters CLI installed! " -NoNewline
61+
Write-Host "Version: $InstalledVersion" -ForegroundColor DarkGray
62+
Write-Host ""
5963
} finally {
6064
# Cleanup
6165
if (Test-Path $TempDir) {

0 commit comments

Comments
 (0)