Crates.io | format-aliases |
lib.rs | format-aliases |
version | 0.1.0 |
source | src |
created_at | 2023-05-16 21:44:47.521313 |
updated_at | 2023-05-16 21:44:47.521313 |
description | Print active shell aliases with nice formatting |
homepage | https://github.com/adam-gaia/format-aliases |
repository | https://github.com/adam-gaia/format-aliases |
max_upload_size | |
id | 866346 |
size | 50,724 |
This is a reimplementation of the OhMyZsh alias cheatsheet plugin.
$ alias
[nvim]
vim='nvim'
wiki='nvim +VimwikiIndex'
[vim]
emacs='vim'
vi='vim'
[ls]
l='ls -alh'
ll='ls -l'
[path]
spath='path --sort'
tpath='path --tree'
cargo install format-aliases
This repo is a flake. The derivation with the exec is format-aliases.packages.${system}.default
Run the format-aliases
init sequence in your shell's rc file. A new function will be included in your shell that overrides the alias
builtin.
# Posix shell example
alias() {
if [ $# -eq 0 ]; then
# Pipe the output of the builtin alias command to be formatted
builtin alias | format-aliases
else
# Pass the arguments to the builtin alias command
builtin alias ${@}
fi
}
eval "$(format-aliases init zsh)"
eval "$(format-aliases init bash)"
eval "$(format-aliases init sh)"
Run the new alias
command without any args to display all active aliases. Running with input args will pass args to the shell's alias
builtin.
Printing in color is enabled by default. Set env var NO_COLOR
to disable.
NO_COLOR alias