Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Bash Alias Generator and Manager

License

NotificationsYou must be signed in to change notification settings

DannyBen/alf

Repository files navigation

Alf - Your Little Bash Alias Friend

VersionBuild Status


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

Features

  • 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 yourconfig file to GitHub.
  • Does not alter anything in your system except for creating the~/.bash_aliases file, which is normally already sourced by your loginprocess.
  • Works with bash and zsh.

Demo

Demo

Installation

Install thealf executable script:

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

If you prefer to install manually, simply download thealf 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).

Using with GitHub-hosted configuration (recommended)

The easiest way to use alf is to create a repository on github, call italf-conf, and put analf.conf file in it.

1. Create your ownalf-conf repository

2. Connect alf to your repository

$ alf connect<your github user>

3. Save and source your aliases

$ alf save$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 tocreate yourbash_aliases file from a local configuration file.

1. Create youralf.conf file

See the samplealf.conf file as a starting point.

2. Save and source your aliases

$ alf save$source~/.bash_aliases

Additional usage patterns

$ alf --helpalf - Your Little Bash Alias FriendUsage:  alf [command]  alf [command] --help | -h  alf --version | -vCommands:  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  info       Show all alf related system factsOptions:  --help, -h    Show this help  --version, -v    Show version numberEnvironment Variables:  ALF_RC_FILE    Path to alfrc file    This file holds the path to the alf-conf repository    Default: ~/.alfrc

File format reference (alf.conf)

Uninstalling

To uninstall alf:

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

Compatibility

Alf was tested onbash andzsh (and might work with other shells).

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

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

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 usingzsh, you should enable completion by adding this to your~/.zshrc (if is it notalready there) before sourcing.bash_aliases:

# Load completion functionsautoload -Uz +X compinit&& compinitautoload -Uz +X bashcompinit&& bashcompinit

Related Projects

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

Contributing / Support

If you experience any issue, have a question or a suggestion, or if you wishto contribute, feel free toopen an issue.



[8]ページ先頭

©2009-2025 Movatter.jp