mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-02-06 04:49:15 +01:00
Updated install-github-cli.ps1
This commit is contained in:
parent
fb7ff43546
commit
c54f644f26
@ -6,7 +6,7 @@
|
|||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./install-github-cli.ps1
|
PS> ./install-github-cli.ps1
|
||||||
⏳ Installing GitHub CLI...
|
⏳ Installing GitHub CLI...
|
||||||
✔ Installation of GitHub CLI took 17 sec
|
✔ GitHub CLI installed successfully in 17s - to authenticate execute: 'gh auth login'.
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
"⏳ Installing GitHub CLI..."
|
"⏳ Installing GitHub CLI..."
|
||||||
$StopWatch = [system.diagnostics.stopwatch]::startNew()
|
$stopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||||
|
|
||||||
if ($IsMacOS) {
|
if ($IsMacOS) {
|
||||||
& brew install gh
|
& brew install gh
|
||||||
@ -23,9 +23,10 @@ try {
|
|||||||
& sudo apt install gh
|
& sudo apt install gh
|
||||||
} else {
|
} else {
|
||||||
& winget install --id GitHub.cli
|
& 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
|
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
|
||||||
"✔️ Installation of GitHub CLI took $Elapsed sec"
|
"✔️ GitHub CLI installed successfully in $($elapsed)s - to authenticate execute: 'gh auth login'"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
Loading…
Reference in New Issue
Block a user