feat(customizations): add removal commands
This commit is contained in:
1 parent
29c0e98272
commit
05663197f7
6 files changed
+333
No files matched your search
@@ -0,0 +1,27 @@
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[ValidateSet('Codex','Claude','Both')][string]$Client,
|
||||
[string]$Key
|
||||
)
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$root = Split-Path (Split-Path $PSScriptRoot -Parent) -Parent
|
||||
. (Join-Path $root 'scripts/lib/install-targets.ps1')
|
||||
$selectedClient = $Client
|
||||
$selectedKey = $Key
|
||||
. (Join-Path $root 'scripts/lib/credentials.ps1')
|
||||
$Client = $selectedClient
|
||||
$Key = $selectedKey
|
||||
|
||||
if (-not $Client) { $Client = Read-InstallClient -Client $Client }
|
||||
if (-not $Key) { $Key = Read-Host 'Credential key to remove' }
|
||||
Assert-CredentialKey $Key
|
||||
|
||||
foreach ($target in $(if ($Client -eq 'Both') { @('Codex', 'Claude') } else { @($Client) })) {
|
||||
try {
|
||||
Remove-ManagedCredential $target $Key
|
||||
Write-Output "Credential removed for $($target.ToLowerInvariant())."
|
||||
} catch [ComponentModel.Win32Exception] {
|
||||
if ($_.Exception.NativeErrorCode -ne 1168) { throw }
|
||||
Write-Output "Credential not found for $($target.ToLowerInvariant())."
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user