-
-
Notifications
You must be signed in to change notification settings - Fork 439
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<# | ||
.SYNOPSIS | ||
Uninstalls GitHub CLI | ||
.DESCRIPTION | ||
This PowerShell script uninstalls the GitHub CLI from the local computer. | ||
.EXAMPLE | ||
PS> ./uninstall-github-cli.ps1 | ||
⏳ Uninstalling GitHub CLI... | ||
✔️ Removal of GitHub CLI took 7 sec | ||
.LINK | ||
https://github.com/fleschutz/PowerShell | ||
.NOTES | ||
Author: Markus Fleschutz | License: CC0 | ||
#> | ||
|
||
try { | ||
"⏳ Uninstalling GitHub CLI..." | ||
$StopWatch = [system.diagnostics.stopwatch]::startNew() | ||
|
||
& winget uninstall --id GitHub.cli | ||
if ($lastExitCode -ne "0") { throw "Can't uninstall GitHub CLI, is it installed?" } | ||
|
||
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds | ||
"✔️ Removal of GitHub CLI took $Elapsed sec" | ||
exit 0 # success | ||
} catch { | ||
"Sorry: $($Error[0])" | ||
exit 1 | ||
} |