Skip to content

Instantly share code, notes, and snippets.

@potatoqualitee
Last active March 28, 2021 21:10
Show Gist options
  • Save potatoqualitee/ff6e42c6a9255279267b4b7d0419ee45 to your computer and use it in GitHub Desktop.
Save potatoqualitee/ff6e42c6a9255279267b4b7d0419ee45 to your computer and use it in GitHub Desktop.
two prompts
add_newline = false
format = "$cmd_duration $directory[❯](fg:#ffffff) "
[cmd_duration]
min_time = 0
format = "\\[[$duration](bold yellow)\\]"
[git_status]
disabled = true
[directory]
format = "[$path](red)(fg:#ffffff)"
truncate_to_repo = false
truncation_length = -1
[directory.substitutions]
"~" = "🏠"
function Prompt {
try {
$history = Get-History -ErrorAction Ignore -Count 1
if ($history) {
Write-Host "[" -NoNewline
$ts = New-TimeSpan $history.StartExecutionTime $history.EndExecutionTime
switch ($ts) {
{ $_.TotalSeconds -lt 1 } {
[int]$d = $_.TotalMilliseconds
'{0}ms' -f ($d) | Write-Host -NoNewline
break
}
{ $_.totalminutes -lt 1 } {
[int]$d = $_.TotalSeconds
'{0}s' -f ($d) | Write-Host -NoNewline
break
}
{ $_.totalminutes -ge 1 } {
"{0:HH:mm:ss}" -f ([datetime]$ts.Ticks) | Write-Host -NoNewline
break
}
}
Write-Host "] " -NoNewline
}
if (Get-Module Posh-git) {
Write-VcsStatus
Write-Host " " -NoNewline
}
} catch { }
Write-Host "$($pwd.path)" -NoNewline
"> "
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment