Add install-github-cli.ps1

This commit is contained in:
Markus Fleschutz 2021-08-24 21:46:11 +02:00
parent d55bf05845
commit 945c07606e
3 changed files with 35 additions and 0 deletions

View File

@ -75,6 +75,7 @@ fetch-repos.ps1, fetches updates for all Git repositories under the current/give
generate-qrcode.ps1, generates a QR code
hibernate.ps1, enables hibernate mode for the local computer (needs admin rights)
inspect-exe.ps1, prints basic information of the given executable file
install-github-cli.ps1, installs GitHub CLI
install-google-chrome.ps1, installs the Google Chrome browser
install-knot-resolver.ps1, installs the Knot Resolver (needs admin rights)
install-signal-cli.ps1, installs signal-cli from github.com/AsamK/signal-cli

1 Script Description
75 generate-qrcode.ps1 generates a QR code
76 hibernate.ps1 enables hibernate mode for the local computer (needs admin rights)
77 inspect-exe.ps1 prints basic information of the given executable file
78 install-github-cli.ps1 installs GitHub CLI
79 install-google-chrome.ps1 installs the Google Chrome browser
80 install-knot-resolver.ps1 installs the Knot Resolver (needs admin rights)
81 install-signal-cli.ps1 installs signal-cli from github.com/AsamK/signal-cli

View File

@ -53,6 +53,7 @@ Mega Collection of PowerShell Scripts
* [check-windows-system-files.ps1](Scripts/check-windows-system-files.ps1) - checks the validity of the Windows system files (needs admin rights)
* [enable-crash-dumps.ps1](Scripts/enable-crash-dumps.ps1) - enables the writing of crash dumps
* [hibernate.ps1](Scripts/hibernate.ps1) - enables hibernate mode for the local computer (needs admin rights)
* [install-github-cli.ps1](Scripts/install-github-cli.ps1) - installs GitHub CLI
* [install-google-chrome.ps1](Scripts/install-google-chrome.ps1) - installs the Google Chrome browser
* [install-knot-resolver.ps1](Scripts/install-knot-resolver.ps1) - installs the Knot Resolver (needs admin rights)
* [install-ssh-client.ps1](Scripts/install-ssh-client.ps1) - installs the SSH client (needs admin rights)

View File

@ -0,0 +1,33 @@
<#
.SYNOPSIS
install-github-cli.ps1
.DESCRIPTION
Installs GitHub CLI
.EXAMPLE
PS> .\install-github-cli.ps1
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz
License: CC0
#>
try {
$StopWatch = [system.diagnostics.stopwatch]::startNew()
if ($IsMacOS) {
brew install gh
} elseif ($IsLinux) {
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo gpg --dearmor -o /usr/share/keyrings/githubcli-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
sudo apt update
sudo apt install gh
}
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
"✔️ installed GitHub CLI in $Elapsed sec"
exit 0
} catch {
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1
}