Update install-github-cli.ps1 and uninstall-github-cli.ps1

This commit is contained in:
Markus Fleschutz 2023-08-10 14:47:49 +02:00
parent 74811f7fe6
commit 9365203245
2 changed files with 7 additions and 4 deletions

View File

@ -20,9 +20,6 @@ try {
if ($IsMacOS) { if ($IsMacOS) {
& brew install gh & brew install gh
} elseif ($IsLinux) { } 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 & sudo apt install gh
} else { } else {
& winget install --id GitHub.cli & winget install --id GitHub.cli

View File

@ -17,7 +17,13 @@ try {
"⏳ Uninstalling GitHub CLI..." "⏳ Uninstalling GitHub CLI..."
$StopWatch = [system.diagnostics.stopwatch]::startNew() $StopWatch = [system.diagnostics.stopwatch]::startNew()
if ($IsMacOS) {
& brew uninstall gh
} elseif ($IsLinux) {
& sudo apt remote gh
} else {
& winget uninstall --id GitHub.cli & winget uninstall --id GitHub.cli
}
if ($lastExitCode -ne "0") { throw "Can't uninstall GitHub CLI, is it installed?" } if ($lastExitCode -ne "0") { throw "Can't uninstall GitHub CLI, is it installed?" }
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds [int]$Elapsed = $StopWatch.Elapsed.TotalSeconds