ps/Modules/Cole.PowerShell.Developer/TODO/Invoke-Choco.ps1

48 lines
1.2 KiB
PowerShell
Raw Normal View History

2023-05-30 22:51:22 -07:00
Function Invoke-Choco {
param(
[ValidateSet('install','upgrade','uninstall','list','sources')]
[string]$verb,
[ValueFromRemainingArguments]
$varargs
)
$modifiedVarArgs = @()
foreach ($varArg in $varargs) {
if ($varArg.StartsWith('--')) {
# skip the first hyphen
$varArg = $varArg.Substring(1)
}
$modifiedVarArgs += $varArg
}
switch ($verb) {
'install'
'upgrade' {
Invoke-ChocoUpgradeCommand @modifiedVarArgs
}
}
}
Function Invoke-ChocoUpgradeCommand {
param (
[switch]$skipDependencies,
[switch]$skipScripts,
[string]$Version
[ValueFromRemainingArguments]
$packageIds
)
# List of operations
# Verify package exists on feed (at version or get latest)
# Move an existing package from /lib to /lib-bkp
# Download a package to /lib-tmp
# Extract package to /lib
# on failure, move /lib-tmp to /lib-bad
# on failure, move /lib-bkp to /lib
# ADD: ping home that package got installed
# BONUS: I don't have to fucking be goddamn singlethreaded for logging
}
Set-Alias -Name choco -Value Invoke-Choco