<commit_before>function Get-GitBranch
{
	$branch = git branch -a 2> $null | Where-Object {$_ -match "^\*"}
	if ($branch -eq $null) {
		return $null
	}
	
	$branch = $branch.Substring(2)
	
	if ($branch -match "^\(.*\)$") {
		$branch = (git name-rev HEAD 2> $null).Substring(5)
	}
	
	$workdir = ([io.fileinfo](git workdir 2> $null)).basename
	
	"$($workdir):$($branch)"
}

function prompt
{
	$exit = $LastExitCode
	if ($exit -eq $null) {
		$exit = 0
	}
	
	$git = Get-GitBranch
	if ($git -ne $null) { 
		$git = "[$git] "
	}
	
	# Reset $LastExitCode so we don't get confusing things happening because of stuff we've run
	cmd /c "exit $($exit)"
	
	# Right prompt
	$rprompt = "[$($exit)]"
	Write-Host (" " * ($host.ui.rawui.windowsize.width - $rprompt.length - 1) + "$($rprompt)`r") -nonewline
	
	# Left prompt
	"$($git)$($executionContext.SessionState.Path.CurrentLocation) $('$' * ($nestedPromptLevel + 1)) "
}<commit_msg>Add colorised prompts for windows!<commit_after>function Get-GitBranch
{
	$branch = git branch -a 2> $null | Where-Object {$_ -match "^\*"}
	if ($branch -eq $null) {
		return $null
	}
	
	$branch = $branch.Substring(2)
	
	if ($branch -match "^\(.*\)$") {
		$branch = (git name-rev HEAD 2> $null).Substring(5)
	}
	
	$workdir = ([io.fileinfo](git workdir 2> $null)).basename
	
	"$($workdir):$($branch)"
}

function prompt
{
	$exit = $LastExitCode
	if ($exit -eq $null) {
		$exit = 0
	}
	
	$git = Get-GitBranch
	if ($git -ne $null) { 
		$git = "[$git] "
	}
	
	# Reset $LastExitCode so we don't get confusing things happening because of stuff we've run
	cmd /c "exit $($exit)"
	
	# Right prompt
	$rprompt = "[$($exit)]"
	Write-Host (" " * ($host.ui.rawui.windowsize.width - $rprompt.length - 1) + "$($rprompt)`r") -NoNewline -ForegroundColor DarkGray
	
	# Left prompt
	Write-Host ($git) -NoNewline -ForegroundColor DarkRed
	Write-Host ("$($executionContext.SessionState.Path.CurrentLocation) ") -NoNewline -ForegroundColor DarkGreen
	"$('$' * ($nestedPromptLevel + 1)) "
}
{'fraction_non_alphanumeric': 0.19606854838709678, 'fraction_numerical': 0.008064516129032258, 'mean_word_length': 3.65962441314554, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2740438', 'n_tokens_mistral': 815, 'n_tokens_neox': 740, 'n_words': 183}