aliaser-bash
v1.0.1
Published
An alias management / directory navigation tool. Tested on MacOS and Ubuntu using Bash and Zsh.
Downloads
20
Maintainers
Readme
aliaser
An alias management / directory navigation tool.
Installation
Aliaser is a single bash function, so you can clone / download this repo and source the file directly:
$ git clone https://github.com/unforswearing/aliaser.git .
$ cd aliaser
$ source aliaser
Or using npm
:
$ npm install -g aliaser-bash
For persistent use you may source aliaser
from your .bashrc
, .bash_profile
or other config. For more information, see the "Usage" section below.
Usage
When aliaser
is run for the first time it will create a .aliaser
directory that contains the alias text file. Use aliaser open
to view the this file in your default .txt
file editor. You may also use aliaser edit
to edit this file in your terminal.
Add source ~/.aliaser/aliaser.txt
to your bash_profile
before creating your first alias. Aliases created via aliaser
are available immediately.
Typing aliaser help
produces the following help text:
aliaser <option> [alias name]
options:
-h|help display this help message
-o|open open the alias file with the default gui editor (e.g. TextEdit)
-l|list list aliases saved in alias file
-e|edit edit alias file in $EDITOR
-r|rm remove alias from alias file
-d|dir create an alias from the current directory (alias name is basename)
-n|name create an alias from the current directory with a user defined name
-s|search search alias file and execute selection
-a|searchall search all aliases system wide and execute selection
-c|command create an alias from the previous command with a user defined name
examples:
aliaser rm "aliasname" remove alias named "aliasname" from alias file
aliaser -n "favoritedir" add an alias for the current directory named
"favoritedir" to alias file
be sure to source the alias file in your .bashrc or .bash_profile
After sourcing aliaser
, you can navigate to a directory and make some aliases:
$ cd ~/scripts
$ aliaser -d myscripts
Or create an alias for the previously executed command:
# execute a command command
$ b=1 && \
> while [ $b -le 2 ]; do
> tput flash; sleep .02;
> b=$((b + 1));
> done
# create alias for previously executed command
$ aliaser -c "flash_terminal"
aliaser
will use fzf
if it is installed and in your $PATH. Otherwise, aliaser
will default to listbox
which is embedded in the aliaser script.