public/Read-UserInput.ps1

function Read-UserInput {
    <#
        .EXAMPLE
            Read-UserInput -Message 'Have you pulled the latest version of the required branches?'
    #>

    [CmdletBinding()]
    param(

        [Parameter(Mandatory=$true)]
        [ValidateNotNullOrEmpty()]
        [string]$Message,

        [Parameter(Mandatory=$true)]
        [ValidateNotNullOrEmpty()]
        [string]$Title

    )
    process{

        $ErrorActionPreference = 'Stop'

        try {

            $Yes = New-Object -TypeName System.Management.Automation.Host.ChoiceDescription "&Yes","Description." -ErrorAction Stop
            $No = New-Object -TypeName System.Management.Automation.Host.ChoiceDescription "&No","Description." -ErrorAction Stop
            $Options = [System.Management.Automation.Host.ChoiceDescription[]]($Yes, $No)
            $Message = $Message
            $Result = $host.ui.PromptForChoice($Title, $Message, $Options, 1)

            return $Result

        }
        catch {

            throw "$($MyInvocation.MyCommand.Name): $_.Exception.Message"

        }

    } # process

} # function