Skip to content

Instantly share code, notes, and snippets.

@Ryan2065
Created August 18, 2020 17:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ryan2065/a8f5fd477ddd40a401a85e8c9562f393 to your computer and use it in GitHub Desktop.
Save Ryan2065/a8f5fd477ddd40a401a85e8c9562f393 to your computer and use it in GitHub Desktop.
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