@@ -55,11 +55,9 @@ function check_slack_binary_exist() {
5555 delay 0.2 " Heads up! A binary called `` $SLACK_CLI_NAME `` was found!"
5656 delay 0.3 " Now checking if it's the same Slack CLI..."
5757 }
58- Write-Host " starting $SLACK_CLI_NAME _fingerprint"
59- & $SLACK_CLI_NAME _fingerprint
60- $get_finger_print = (& $SLACK_CLI_NAME _fingerprint 2>&1 | Out-String ).Trim()
58+ & $SLACK_CLI_NAME _fingerprint | Tee-Object - Variable get_finger_print | Out-Null
6159 if ($get_finger_print -ne $FINGERPRINT ) {
62- $slack_cli_version = ( & $SLACK_CLI_NAME -- version 2>&1 | Out-String )
60+ & $SLACK_CLI_NAME -- version | Tee-Object - Variable slack_cli_version | Out-Null
6361 if (! ($slack_cli_version -contains " Using ${SLACK_CLI_NAME} .exe v" )) {
6462 Write-Host " Error: Your existing `` $SLACK_CLI_NAME `` command is different from this Slack CLI!"
6563 Write-Host " Halting the install to avoid accidentally overwriting it."
@@ -162,17 +160,9 @@ function install_slack_cli {
162160 $Path = [System.Environment ]::GetEnvironmentVariable(' Path' , $User )
163161 if (! (" ;${Path} ;" .ToLower() -like " *;${slack_cli_bin_dir} ;*" .ToLower())) {
164162 Write-Host " Adding `` $confirmed_alias .exe`` to your Path environment variable"
165- if ([Environment ]::UserInteractive) {
166- try {
167- [System.Environment ]::SetEnvironmentVariable(' Path' , $Path.TrimEnd (' ;' ) + " ;${slack_cli_bin_dir} " , $User )
168- }
169- catch {
170- # Silently continue if SetEnvironmentVariable fails
171- }
172- }
163+ [System.Environment ]::SetEnvironmentVariable(' Path' , $Path.TrimEnd (' ;' ) + " ;${slack_cli_bin_dir} " , $User )
173164 $Env: Path = $Env: Path.TrimEnd (' ;' ) + " ;$slack_cli_bin_dir "
174165 }
175-
176166 Remove-Item " $ ( $slack_cli_dir ) \slack_cli.zip"
177167}
178168
@@ -186,7 +176,7 @@ function install_git {
186176 }
187177 else {
188178 try {
189- git -- version | Out-Null
179+ git | Out-Null
190180 Write-Host " Git is already installed. Nice!"
191181 }
192182 catch [System.Management.Automation.CommandNotFoundException ] {
@@ -219,8 +209,8 @@ function terms_of_service {
219209 [Parameter (HelpMessage = " Alias of Slack CLI" )]
220210 [string ]$Alias
221211 )
222- $confirmed_alias = check_slack_binary_exist $Alias $Version $true
223- if (Get-Command $confirmed_alias - ErrorAction SilentlyContinue ) {
212+ $confirmed_alias = check_slack_binary_exist $Alias $Version $false
213+ if (Get-Command $confirmed_alias ) {
224214 Write-Host " `n Use of the Slack CLI should comply with the Slack API Terms of Service:"
225215 Write-Host " https://slack.com/terms-of-service/api"
226216 }
@@ -232,7 +222,7 @@ function feedback_message {
232222 [string ]$Alias
233223 )
234224 $confirmed_alias = check_slack_binary_exist $Alias $Version $false
235- if (Get-Command $confirmed_alias - ErrorAction SilentlyContinue ) {
225+ if (Get-Command $confirmed_alias ) {
236226 Write-Host " `n We would love to know how things are going. Really. All of it."
237227 Write-Host " Survey your development experience with `` $confirmed_alias feedback`` "
238228 }
@@ -246,7 +236,7 @@ function next_step_message {
246236 $confirmed_alias = check_slack_binary_exist $Alias $Version $false
247237 if (Get-Command $confirmed_alias - ErrorAction SilentlyContinue) {
248238 try {
249- & $confirmed_alias -- version | Out-Null
239+ $confirmed_alias | Out-Null
250240 Write-Host " `n You're all set! Relaunch your terminal to ensure changes take effect."
251241 Write-Host " Then, authorize your CLI in your workspace with `` $confirmed_alias login`` .`n "
252242 }
@@ -261,9 +251,6 @@ function next_step_message {
261251trap {
262252 Write-Host " `n We would love to know how things are going. Really. All of it."
263253 Write-Host " Submit installation issues: https://github.com/slackapi/slack-cli/issues"
264-
265-
266- $_ | Format-List * | Out-String | Write-Host
267254 exit 1
268255}
269256
0 commit comments