From 62a14171abde48772b085fc233abd44623306a67 Mon Sep 17 00:00:00 2001 From: dovholuknf <46322585+dovholuknf@users.noreply.github.com> Date: Tue, 21 Mar 2023 14:59:42 -0400 Subject: [PATCH] update the getZiti.ps1 with a bit of output and vastly better performance via Continue --- quickstart/getZiti.ps1 | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/quickstart/getZiti.ps1 b/quickstart/getZiti.ps1 index 75a85be1b..901775c14 100644 --- a/quickstart/getZiti.ps1 +++ b/quickstart/getZiti.ps1 @@ -16,7 +16,7 @@ None. None. If "dot sourced" this script will add the resultant directory to your path .EXAMPLE -PS> . .\getLatestZiti.ps1 +PS> . .\getZiti.ps1 #> $latestFromGitHub=(irm https://api.github.com/repos/openziti/ziti/releases/latest) $version=($latestFromGitHub.tag_name) @@ -37,11 +37,23 @@ if($(Test-Path -Path $zipFile -PathType Leaf)) { Write-Output "Downloading file " Write-Output " from: ${downloadUrl} " Write-Output " to: ${zipFile}" + $SavedProgressPreference=$ProgressPreference + $ProgressPreference='SilentlyContinue' iwr ${downloadUrl} -OutFile "$zipFile" + $ProgressPreference=$SavedProgressPreference } Expand-Archive -Path $zipFile -DestinationPath "${toDir}\${version}" -ErrorAction SilentlyContinue -if(! $env:Path.Contains("${toDir}\${version}\ziti\")){ - $env:Path+=";${toDir}\${version}\ziti\" +Write-Output " " +Write-Output "Extracted binaries to ${toDir}\${version}\ziti" +Write-Output " " +$addToPath=$(Read-Host "Would you like to add ziti to this session's path? [default: Y]") +if($addToPath.Trim() -eq "") { + $addToPath=("Y") } + +if($addToPath -ilike "y*") { + $env:Path+=";${toDir}\${version}\ziti\" + Write-Output "ziti added to your path!" +} \ No newline at end of file