Created
August 18, 2020 17:46
-
-
Save Ryan2065/a8f5fd477ddd40a401a85e8c9562f393 to your computer and use it in GitHub Desktop.
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 | |
{ | |
#Based off https://dbatools.io/prompt/ - but doesn't show the current time. | |
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