Updated install-github-cli.ps1

This commit is contained in:
Markus Fleschutz 2024-09-22 10:43:38 +02:00
parent fb7ff43546
commit c54f644f26

View File

@ -6,7 +6,7 @@
.EXAMPLE
PS> ./install-github-cli.ps1
Installing GitHub CLI...
Installation of GitHub CLI took 17 sec
GitHub CLI installed successfully in 17s - to authenticate execute: 'gh auth login'.
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
@ -15,7 +15,7 @@
try {
"⏳ Installing GitHub CLI..."
$StopWatch = [system.diagnostics.stopwatch]::startNew()
$stopWatch = [system.diagnostics.stopwatch]::startNew()
if ($IsMacOS) {
& brew install gh
@ -23,9 +23,10 @@ try {
& sudo apt install gh
} else {
& winget install --id GitHub.cli
if ($lastExitCode -ne "0") { throw "Installation of GitHub CLI failed, maybe it's already installed." }
}
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
"✔️ Installation of GitHub CLI took $Elapsed sec"
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
"✔️ GitHub CLI installed successfully in $($elapsed)s - to authenticate execute: 'gh auth login'"
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"