Alf enhances your bash alias management. It was developed using the Bashly Command Line Framework.
- Create aliases by using a config file.
- Create aliases for sub-commands (for example,
g s
forgit status
). - Synchronize your aliases across hosts or users by uploading your config file to GitHub.
- Does not alter anything in your system except for creating the
~/.bash_aliases
file, which is normally already sourced by your login process.
Install the alf
executable script:
$ bash <(curl -Ls get.dannyb.co/alf/setup)
If you prefer to install manually, simply download the alf file, place it somewhere in your path, and make it executable.
Note that alf requires bash 4.0 or higher (brew install bash
for mac users).
The easiest way to use alf is to create a repository on github, call it
alf-conf
, and put an alf.conf
file in it.
- See the alf.conf file as a starting point, or
- Generate a template from my alf-conf
$ alf connect <your github user>
$ alf save
$ source ~/.bash_aliases # this normally already exists in your ~/.bashrc
If you want to try alf before creating your Github repo, use this method to
create your bash_aliases
file from a local configuration file.
See the sample alf.conf file as a starting point.
$ alf save
$ source ~/.bash_aliases
$ alf --help
alf - Your Little Bash Alias Friend
Usage:
alf [command]
alf [command] --help | -h
alf --version | -v
Commands:
connect Connect to a remote git repository
download Perform git pull on the connected repo
upload Perform git commit and push on the connected repo
generate Generate aliases to stdout
save Generate aliases to ~/.bash_aliases
edit Open your alf.conf for editing
which Show the alias command
upgrade Upgrade alf to the latest version
Options:
--help, -h
Show this help
--version, -v
Show version number
Environment Variables:
ALF_RC_FILE
Path to alfrc file
This file holds the path to the alf-conf repository
Default: ~/.alfrc
To uninstall alf:
# Remove the shell script
sudo rm /usr/local/bin/alf
# Remove .alfrc (exists only if you have performed `alf connect`)
rm -f ~/.alfrc
# Remove .bash_aliases (exists only if you have performed `alf save`)
rm -f ~/.bash_aliases
For a similar project, but for command shortcuts on a per-directory basis, see opcode.
If you experience any issue, have a question or a suggestion, or if you wish to contribute, feel free to open an issue.