Skip to content

Commit 9ba9400

Browse files
committed
Add Windows CMD wrapper for US House software lifecycle operations
1 parent b2db4f7 commit 9ba9400

1 file changed

Lines changed: 60 additions & 0 deletions

File tree

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
@echo off
2+
setlocal EnableExtensions
3+
4+
if "%~1"=="" goto :usage
5+
if "%~2"=="" goto :usage
6+
7+
set "ACTION=%~1"
8+
set "VENDOR=%~2"
9+
set "PACKAGE=%~3"
10+
11+
where winget >nul 2>&1 || (
12+
echo ERROR: winget is required.
13+
exit /b 1
14+
)
15+
16+
if /I "%ACTION%"=="list" goto :list
17+
if "%PACKAGE%"=="" goto :usage
18+
19+
call :resolve "%VENDOR%" "%PACKAGE%"
20+
if errorlevel 1 exit /b 1
21+
22+
if /I "%ACTION%"=="install" winget install --id "%ID%" --exact --accept-package-agreements --accept-source-agreements & goto :done
23+
if /I "%ACTION%"=="update" winget upgrade --id "%ID%" --exact --accept-package-agreements --accept-source-agreements & goto :done
24+
if /I "%ACTION%"=="remove" winget uninstall --id "%ID%" --exact & goto :done
25+
if /I "%ACTION%"=="status" winget list --id "%ID%" --exact & goto :done
26+
27+
echo ERROR: Unknown action: %ACTION%
28+
exit /b 2
29+
30+
:resolve
31+
set "ID="
32+
if /I "%~1"=="microsoft" (
33+
if /I "%~2"=="edge" set "ID=Microsoft.Edge"
34+
if /I "%~2"=="vscode" set "ID=Microsoft.VisualStudioCode"
35+
if /I "%~2"=="powershell" set "ID=Microsoft.PowerShell"
36+
if /I "%~2"=="dotnet" set "ID=Microsoft.DotNet.SDK.8"
37+
if /I "%~2"=="git" set "ID=Git.Git"
38+
)
39+
if /I "%~1"=="apple" (
40+
if /I "%~2"=="icloud" set "ID=Apple.iCloud"
41+
if /I "%~2"=="applemusic" set "ID=Apple.AppleMusic"
42+
if /I "%~2"=="devices" set "ID=Apple.AppleDevices"
43+
)
44+
if not defined ID (
45+
echo ERROR: Unsupported vendor/package alias.
46+
exit /b 1
47+
)
48+
exit /b 0
49+
50+
:list
51+
echo Microsoft: edge, vscode, powershell, dotnet, git
52+
echo Apple: icloud, applemusic, devices
53+
exit /b 0
54+
55+
:usage
56+
echo Usage: US-House-Software.cmd ^<install^|update^|remove^|status^|list^> ^<microsoft^|apple^> [package]
57+
exit /b 2
58+
59+
:done
60+
exit /b %ERRORLEVEL%

0 commit comments

Comments
 (0)