File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22. SYNOPSIS
33 Installs GitHub CLI
44. DESCRIPTION
5- This PowerShell script installs GitHub command-line interface (CLI).
5+ This PowerShell script installs the GitHub command-line interface (CLI).
66. EXAMPLE
77 PS> ./install-github-cli.ps1
8- ✔ GitHub CLI installed successfully in 9 sec
8+ ⏳ Installing GitHub CLI...
9+ ✔ Installation of GitHub CLI took 17 sec
910. LINK
1011 https://github.com/fleschutz/PowerShell
1112. NOTES
1213 Author: Markus Fleschutz | License: CC0
1314#>
1415
1516try {
17+ " ⏳ Installing GitHub CLI..."
1618 $StopWatch = [system.diagnostics.stopwatch ]::startNew()
1719
1820 if ($IsMacOS ) {
1921 & brew install gh
2022 } elseif ($IsLinux ) {
21- curl - fsSL https:// cli.github.com / packages/ githubcli- archive- keyring.gpg | sudo gpg -- dearmor - o / usr/ share/ keyrings/ githubcli- archive- keyring.gpg
23+ & curl - fsSL https:// cli.github.com / packages/ githubcli- archive- keyring.gpg | sudo gpg -- dearmor - o / usr/ share/ keyrings/ githubcli- archive- keyring.gpg
2224 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
23- sudo apt update
24- sudo apt install gh
25+ & sudo apt update
26+ & sudo apt install gh
2527 } else {
2628 & winget install -- id GitHub.cli
27-
29+ }
2830 [int ]$Elapsed = $StopWatch.Elapsed.TotalSeconds
29- " ✔️ GitHub CLI installed successfully in $Elapsed sec"
31+ " ✔️ Installation of GitHub CLI took $Elapsed sec"
3032 exit 0 # success
3133} catch {
3234 " ⚠️ Error in line $ ( $_.InvocationInfo.ScriptLineNumber ) : $ ( $Error [0 ]) "
You can’t perform that action at this time.
0 commit comments