alias-tips is a PowerShell module dedicated to help remembering those shell aliases you once defined. Inspired by the Oh My Zsh plugin alias-tips
The idea is that you might be too afraid to execute aliases defined because you can't remember them correctly, or just have forgotten about some aliases, or that aliases for your daily commands even exist.
Terminal is using oh-my-posh
w/ M365Princess
, git-aliases-plus
, PSReadline
$ git status
Alias tip: gst
:
$ git checkout -b master
Alias tip: gcb master
:
$ git rebase --interactive master
Alias tip: grb --interactive master
:
$ git rebase -i master
Alias tip: grbi master
:
$ Move-Item foo bar
Alias tip: mv foo bar
:
Install the module from the PowerShell Gallery:
Install-Module alias-tips -AllowClobber
Inside your PowerShell profile, import alias-tips.
Import-Module alias-tips
Important
alias-tips should be imported after all your aliases are already declared or imported
Everytime your aliases are updated or changed run Find-AliasTips
Find-AliasTips
This will store a hash of all aliased commands to: $HOME/.alias_tips.hash
. It is not recommended to run on every profile load, as this can significantly slow down your profile startup times.
Other functionality:
alias-tips can be configured via Environment Variables
Environment Variable | Default Value | Description |
---|---|---|
ALIASTIPS_DEBUG | $false |
Enable to show debug messages when processing commands |
ALIASTIPS_HASH_PATH | [System.IO.Path]::Combine("$HOME", '.alias_tips.hash') |
File Path to store results from Find-AliasTips |
ALIASTIPS_MSG | "Alias tip: {0}" |
Alias hint message for non-virtual terminals |
ALIASTIPS_MSG_VT | `e[033mAlias tip: {0}`em" |
Alias hint message for virtual terminals* |
ALIASTIPS_FUNCTION_INTROSPECTION | $false |
POTENTIALLY DESTRUCTIVE Function Alias Introspection |
* This uses ANSI Escape Codes, for a table of colors. This also means alias-tips supports any other virtual terminal features: blinking/bold/underline/italics.
It will attempt to read all functions/aliases set in the current context.
New-Alias -Name g -Value git
function grbi {
git rebase -i $args
}
Note
This has a limitation in that alias-tips does not know in this case that -i is equivalent to the --interactive flag.
function gcm {
$MainBranch = Get-Git-MainBranch
git checkout $MainBranch $args
}
Warning
This is potentially destructive behavior
This requires backparsing as it requires running Get-Git-MainBranch
(in this example) to get the value of $MainBranch
.
This backparsing could be a destructive command is not known to alias-tips, and it will run anyways. (ie. rm, git add, etc.)
As a result this behavior is disabled by default.
Set $env:ALIASTIPS_FUNCTION_INTROSPECTION
to $true
to enable it.
Licensed under the MIT License, Copyright © 2023-present Cody Duong.
See LICENSE for more information.