Skip to content

Instantly share code, notes, and snippets.

@yevster
Last active September 5, 2021 03:27
Show Gist options
  • Save yevster/510bba3d3473718aaec9fe603d0f03fb to your computer and use it in GitHub Desktop.
Save yevster/510bba3d3473718aaec9fe603d0f03fb to your computer and use it in GitHub Desktop.
# SPDX-License-Identifier: MIT
Set-PSReadlineOption -BellStyle None
Set-PSReadlineOption -EditMode Emacs
function Stop-AllContainers() {
docker ps -a -q | ForEach-Object { docker rm -f $_ }
}
New-Alias -Name massacre -Value 'Stop-AllContainers'
function Set-WindowTitle {
param(
# Sets the title of the currnet console/powershell window
[Parameter(Mandatory = $true, ValueFromPipeline = $true)]
[string]
$Title`
)
$Host.UI.RawUI.WindowTitle = $Title
}
New-Alias -Name title -Value 'Set-WindowTitle'
# Prompt
# More on this at https://opensource.com/article/18/7/powershell-tips
function prompt {
$lastResult = Invoke-Expression '$?'
if (!$lastResult) {
Write-Host "Last command exited with error status." -ForegroundColor Red
}
Write-Output "${msg}$(
# Show time as 12:05PM
Get-Date -UFormat "%I:%M%p"
# Show current directory
) $(Get-Location)> "
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment