# encoding: ascii
# api: powershell
# title: coolprompt
# description: A cool prompt function.  Insert code into your profile script (“C:\Users\%username%\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1”).  Must use Consolas font in powershell (set font, then restart powershell) for special characters to appear correctly.  Displays path + uptime in title, example prompt as: jgentile@quadbox&#9679;~\powershell&#9658;
# version: 0.1
# type: class
# license: CC0
# x-poshcode-id: 1788
# x-archived: 2010-04-25T07:49:55
#
#

	$global:wmilocalcomputer = get-WMIObject -class Win32_OperatingSystem -computer "."
	$global:lastboottime=[System.Management.ManagementDateTimeconverter]::ToDateTime($wmilocalcomputer.lastbootuptime)
	$global:originaltitle = [console]::title

function prompt 
{
	$up=$(get-date)-$lastboottime

	$upstr="$([datetime]::now.toshorttimestring()) $([datetime]::now.toshortdatestring()) up $($up.days) days, $($up.hours) hours, $($up.minutes) minutes"

	$dir = $pwd.path

	$homedir = (get-psprovider 'FileSystem').home

	if ($homedir -ne "" -and $dir.toupper().startswith($homedir.toupper()))
	{
		$dir=$dir.remove(0,$homedir.length).insert(0,'~')
	}
	
	$retstr = "$env:username@$($env:computername.tolower())&#9679;$dir" 

	[console]::title = "$global:originaltitle &#9830; $retstr &#9830; $upstr" 

	return "$retstr&#9658;"
}
