Skip to content

Commit c6a67c9

Browse files
committed
Add uninstall-github-cli.ps1
1 parent 5b0c4a8 commit c6a67c9

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

Scripts/uninstall-github-cli.ps1

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<#
2+
.SYNOPSIS
3+
Uninstalls GitHub CLI
4+
.DESCRIPTION
5+
This PowerShell script uninstalls the GitHub CLI from the local computer.
6+
.EXAMPLE
7+
PS> ./uninstall-github-cli.ps1
8+
⏳ Uninstalling GitHub CLI...
9+
✔️ Removal of GitHub CLI took 7 sec
10+
.LINK
11+
https://github.com/fleschutz/PowerShell
12+
.NOTES
13+
Author: Markus Fleschutz | License: CC0
14+
#>
15+
16+
try {
17+
"⏳ Uninstalling GitHub CLI..."
18+
$StopWatch = [system.diagnostics.stopwatch]::startNew()
19+
20+
& winget uninstall --id GitHub.cli
21+
if ($lastExitCode -ne "0") { throw "Can't uninstall GitHub CLI, is it installed?" }
22+
23+
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
24+
"✔️ Removal of GitHub CLI took $Elapsed sec"
25+
exit 0 # success
26+
} catch {
27+
"Sorry: $($Error[0])"
28+
exit 1
29+
}

0 commit comments

Comments
 (0)