internal/configurations/validations/PSUBrowseHistoryOptions.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Register-PSFConfigValidation -Name "PSUBrowseHistoryOptions" -ScriptBlock {
    param (
        $Value
    )
    
    $result = New-Object PSObject -Property @{
        Message  = ""
        Value    = $null
        Success  = $false
    }
    
    try { [PSUtil.Configuration.HistoryOption]$option = $Value }
    catch
    {
        $result.Message = "Could not convert $Value into a valid help option. Please specify either of these: Session | Global"
        return $result
    }
    
    $result.Success = $true
    $result.Value = $option
    
    return $result
}