find-alias
v1.0.1
Published
interactive aliases finder and executor
Downloads
3
Maintainers
Readme
FIND ALIAS
Find-alias is an interactive alias finder and executor, it helps you to quickly find and execute any aliases.
Installation
install with default name: fa
npm install -g find-alias
find-alias --configure
restart the terminal
fa
install with custom program name
npm install -g find-alias
find-alias --configure <<custom-name>>
restart the terminal
<<custom-name>>
Run without installation
- copy the following command to your terminal:
function find-alias {
if [[ -n "$BASH" ]]; then
history -s find-alias "$@"
fi
tmp_file=$(mktemp -t find-alias.XXXXXXX)
aliases_tmp_file=$(mktemp -t find-alias.XXXXXXX)
alias | cat >>"$aliases_tmp_file"
npx find-alias@latest "$@" "$aliases_tmp_file" --height="$(tput lines)" --page-size="$(tput lines)" --output-file="$tmp_file"
result="$(<"$tmp_file")"
rm -f "$tmp_file"
rm -f "$aliases_tmp_file"
if [[ -n "$result" ]]; then
eval "$result"
if [[ -n "$BASH" ]]; then
history -s "$result"
elif [[ -n "$ZSH_VERSION" ]]; then
print -s "$result"
fi
fi
}
- type
find-alias
Features
- run the program by typing
fa
or<<custom-name>>
- to find and run an alias:
- write in any keyword in the quick filter
- use up and down button to choose any of the aliases from the filtered list
- press <enter> to run chosen alias
- to find and add extra arguments before running an alias:
- write in any keyword in the quick filter
- use up and down button to choose from the filtered list
- press <tab>
- write in the extra arguments
- press <enter> to run
Why did I create this software?
- Have you ever felt lost in dozens and dozens (or even hundreds) of different aliases?
- After installing Oh My Bash or Oh My Zsh and adding a few plugins you could simply end up in a with 100+ new aliases, without any easily accessible documentation.
- It happened too many times to me that I knew that an alias exist for my problem, but it requires too much time and
effort to find it, so in the end I just ended up typing in the long command.
- What is the alias for adding all the files to git and amending previous commit without any edit?
- Or what is the alias if I want to edit the commit message?
- Or what is the alias if I only want to add a few files?
- The aim of the program is to give a helper utility where you can find any alias quickly, e.g. the above-mentioned
aliases could be easily found by searching keywords
commit
andamend
and then you can choose which ever you need at the moment.
Uninstalling
npm uninstall -g find-alias
- remove
~/.find-alias.sh
file from your home directory - remove
#find-alias
part from your.bashrc
or.zshrc
file
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.