Skip to content

Commit 817ccee

Browse files
committed
Add US House Windows software convenience menu
1 parent bef5c39 commit 817ccee

1 file changed

Lines changed: 42 additions & 0 deletions

File tree

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
[CmdletBinding()]
2+
param(
3+
[ValidateSet('menu','list','install','update','remove','status','upgrade-all')]
4+
[string]$Action = 'menu',
5+
[ValidateSet('microsoft','apple','all')]
6+
[string]$Vendor = 'all',
7+
[string]$Package,
8+
[switch]$Machine
9+
)
10+
11+
Set-StrictMode -Version Latest
12+
$ErrorActionPreference = 'Stop'
13+
$script = Join-Path $PSScriptRoot 'US-House-Apps.ps1'
14+
15+
if (-not (Test-Path -LiteralPath $script)) {
16+
throw "US-House-Apps.ps1 was not found at $script"
17+
}
18+
19+
function Invoke-House([string]$op) {
20+
$args = @{ Action=$op; Vendor=$Vendor }
21+
if ($Package) { $args.Package=$Package }
22+
if ($Machine) { $args.Machine=$true }
23+
& $script @args
24+
}
25+
26+
switch ($Action) {
27+
'menu' {
28+
Write-Host ''
29+
Write-Host 'US HOUSE — SOFTWARE CONVENIENCE' -ForegroundColor Cyan
30+
Write-Host '1. List catalog'
31+
Write-Host '2. Install'
32+
Write-Host '3. Update'
33+
Write-Host '4. Remove'
34+
Write-Host '5. Status'
35+
Write-Host '6. Upgrade all'
36+
Write-Host '7. Exit'
37+
$choice = Read-Host 'Select'
38+
$map = @{ '1'='list'; '2'='install'; '3'='update'; '4'='remove'; '5'='status'; '6'='upgrade-all' }
39+
if ($map.ContainsKey($choice)) { Invoke-House $map[$choice] }
40+
}
41+
default { Invoke-House $Action }
42+
}

0 commit comments

Comments
 (0)