项目作者: DannyBen

项目描述 :
Bash Alias Generator and Manager
高级语言: Shell
项目地址: git://github.com/DannyBen/alf.git
创建时间: 2017-08-30T16:41:47Z
项目社区:https://github.com/DannyBen/alf

开源协议:MIT License

下载





# Alf - Your Little Bash Alias Friend

Version
Build Status


Alf enhances your bash alias management. It was developed using the
Bashly Command Line Framework.

Features

  • Create aliases by using a config file.
  • Create aliases for sub-commands (for example, g s for git 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.
  • Works with bash and zsh.

Demo

Demo

Installation

Install the alf executable script:

  1. $ curl -Ls get.dannyb.co/alf/setup | bash

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.

1. Create your own alf-conf repository

2. Connect alf to your repository

  1. $ alf connect <your github user>

3. Save and source your aliases

  1. $ alf save
  2. $ source ~/.bash_aliases # this normally already exists in your ~/.bashrc

Using without GitHub

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.

1. Create your alf.conf file

See the sample alf.conf file as a starting point.

2. Save and source your aliases

  1. $ alf save
  2. $ source ~/.bash_aliases

Additional usage patterns

  1. $ alf --help
  2. alf - Your Little Bash Alias Friend
  3. Usage:
  4. alf [command]
  5. alf [command] --help | -h
  6. alf --version | -v
  7. Commands:
  8. connect Connect to a remote git repository
  9. download Perform git pull on the connected repo
  10. upload Perform git commit and push on the connected repo
  11. generate Generate aliases to stdout
  12. save Generate aliases to ~/.bash_aliases
  13. edit Open your alf.conf for editing
  14. which Show the alias command
  15. upgrade Upgrade alf to the latest version
  16. info Show all alf related system facts
  17. Options:
  18. --help, -h
  19. Show this help
  20. --version, -v
  21. Show version number
  22. Environment Variables:
  23. ALF_RC_FILE
  24. Path to alfrc file
  25. This file holds the path to the alf-conf repository
  26. Default: ~/.alfrc

File format reference (alf.conf)

Uninstalling

To uninstall alf:

  1. # Run the uninstall script
  2. $ curl -Ls get.dannyb.co/alf/uninstall | bash
  3. # Optionally, remove .alfrc (exists only if you have performed `alf connect`)
  4. $ rm -f ~/.alfrc
  5. # Optionally, remove .bash_aliases (exists only if you have performed `alf save`)
  6. $ rm -f ~/.bash_aliases

Compatibility

Alf was tested on bash and zsh (and might work with other shells).

In all cases, bash version 4.0 or higher must be installed, since alf uses
associative arrays which are not available in older versions.

If your shell does not automatically source ~/.bash_aliases on startup, you
should add this line to your startup script:

  1. source ~/.bash_aliases

ZSH Users

Oh-My-Zsh users may skip this step.

If you would like to have autocompletion for alf’s sub-aliases and you are using
zsh, you should enable completion by adding this to your ~/.zshrc (if is it not
already there) before sourcing .bash_aliases:

  1. # Load completion functions
  2. autoload -Uz +X compinit && compinit
  3. autoload -Uz +X bashcompinit && bashcompinit

For a similar project, but for command shortcuts on a per-directory basis,
see opcode.

Contributing / Support

If you experience any issue, have a question or a suggestion, or if you wish
to contribute, feel free to open an issue.