Last active
November 4, 2022 19:37
-
-
Save potatoqualitee/f73eaea0306773cc54a33773aacc5120 to your computer and use it in GitHub Desktop.
prompt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Prompt | |
{ | |
Write-Host "[" -NoNewline | |
Write-Host (Get-Date -Format "HH:mm:ss") -ForegroundColor Gray -NoNewline | |
try | |
{ | |
$history = Get-History -ErrorAction Ignore | |
if ($history) | |
{ | |
Write-Host "][" -NoNewline | |
if (([System.Management.Automation.PSTypeName]'Sqlcollaborative.Dbatools.Utility.DbaTimeSpanPretty').Type) | |
{ | |
Write-Host ([Sqlcollaborative.Dbatools.Utility.DbaTimeSpanPretty]($history[-1].EndExecutionTime - $history[-1].StartExecutionTime)) -ForegroundColor Gray -NoNewline | |
} | |
else | |
{ | |
Write-Host ($history[-1].EndExecutionTime - $history[-1].StartExecutionTime) -ForegroundColor Gray -NoNewline | |
} | |
} | |
} | |
catch { } | |
Write-Host "] $($executionContext.SessionState.Path.CurrentLocation.ProviderPath)" -NoNewline | |
"> " | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment