plugins/pscolor/src/module/src/public/Remove-OMPColorAction.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
Function Remove-OMPColorAction {
    <#
    .SYNOPSIS
        Removes a colorization action.
    .DESCRIPTION
        Removes a colorization action.
    .PARAMETER Name
        Type name to remove
 
    .EXAMPLE
        PS> Remove-OMPColorAction -Name 'Custom.Type'
 
    .NOTES
        Author: Zachary Loeber
 
 
        Version History
        1.0.0 - Initial release
    #>

    [CmdletBinding()]
    param (
        [Parameter(Position = 0, Mandatory = $true)]
        [string]$Name
    )
    Get-CallerPreference -Cmdlet $PSCmdlet -SessionState $ExecutionContext.SessionState

    if ($Script:PSColorTypeMapKeys -contains $Name) {
        ($Script:PSColorTypeMap).Remove($Name)
        $Script:PSColorTypeMapKeys = ($script:PSColorTypeMap).Keys
    }
    else {
        Write-Error "Typename of $Name does not exist!"
    }
}