Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 26 additions & 16 deletions install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -218,28 +218,38 @@ function Main {
[switch]$Uninstall
)

if ($Uninstall) {
Uninstall-App
}
$oldProgressPreference = $ProgressPreference
$ProgressPreference = 'SilentlyContinue'

try {
if ($Uninstall) {
Uninstall-App
return
}

Show-Title "Downloading PairSpaces CLI"
Show-Title "Downloading PairSpaces CLI"

$arch = Get-Arch
$version = Get-Version
$file = "$name" + "_$version.exe"
$url = "$baseUrl/windows/$arch/$file"
$arch = Get-Arch
$version = Get-Version
$file = "$name" + "_$version.exe"
$url = "$baseUrl/windows/$arch/$file"

Ensure-InstallDir
Ensure-InstallDir

$downloadPath = "$installDir\$binary"
Download-Binary -url $url -outputPath $downloadPath
$downloadPath = "$installDir\$binary"
Download-Binary -url $url -outputPath $downloadPath

Show-Title "Installing PairSpaces CLI" $url
Make-Executable $downloadPath
Ensure-InPath
Show-Title "Installing PairSpaces CLI" $url
Make-Executable $downloadPath
Ensure-InPath

Show-Title "Installation Complete" "$binary installed to $installDir"
Write-Host (" Restart your shell and run '${binary} help' to get started.") -ForegroundColor Green
Show-Title "Installation Complete" "$binary installed to $installDir"
Write-Host (" Restart your shell and run '${binary} help' to get started.") -ForegroundColor Green
}
finally {
# Always restore original preference
$ProgressPreference = $oldProgressPreference
}
}

if ($MyInvocation.InvocationName -ne '.') {
Expand Down