<#
	.SYNOPSIS
		Display text in the center of the terminal window.
	.DESCRIPTION
		* Bonus Example: Selection Menu
		A function that calculates the center of the console by character columns to display some text,
		This is mostly a stylistic function. It doesn't fair very well when the console window is resized.
#>
# Get-Help wont work if script starts with function...
Write-Host "`n" (Get-Help $PSCommandPath).synopsis

function Write-HostCenter {
	param($Message)
	Write-Host ("{0}{1}" -f (' ' * (([Math]::Max(0, $Host.UI.RawUI.BufferSize.Width / 2) - [Math]::Floor($Message.Length / 2)))), $Message)
}

function Show-Menu {
	param ([string]$Title = 'My Menu')
	Clear-Host
	Write-HostCenter "================ $Title ================"

	Write-HostCenter "1: Press '1' for this option."
	Write-HostCenter "2: Press '2' for this option."
	Write-HostCenter "3: Press '3' for this option."
	Write-HostCenter "Q: Press 'Q' to quit."

}

Do {
	Show-Menu
	$input = Read-Host "Please make a selection"
	Switch ($input) {
		'1' { 'You chose option #1' }
		'2' { 'You chose option #2' }
		'3' { 'You chose option #3' }
		'q' { Return }
	}
	Pause
}
Until ($input -eq 'q')
Clear-Host