Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/unforswearing/aliaser

An alias management / directory traversal tool for the command line
https://github.com/unforswearing/aliaser

aliases bash directory-traversal shell

Last synced: 25 days ago
JSON representation

An alias management / directory traversal tool for the command line

Awesome Lists containing this project

README

        

[![shellcheck](https://github.com/unforswearing/aliaser/actions/workflows/shellcheck.yml/badge.svg)](https://github.com/unforswearing/aliaser/actions/workflows/shellcheck.yml)

aliaser
===

*An alias management / directory navigation tool.*

Demo


## Installation

Aliaser is a single bash function, so you can clone / download this repo and source the file directly:

```bash
$ git clone https://github.com/unforswearing/aliaser.git .
$ cd aliaser
$ source aliaser

```

Or using `npm`:

```bash
$ 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 [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:

```bash
$ cd ~/scripts
$ aliaser -d myscripts
```

Or create an alias for the previously executed command:

```bash
# 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`](https://github.com/junegunn/fzf) if it is installed and in your $PATH. Otherwise, `aliaser` will default to [`listbox`](https://github.com/gko/listbox) which is embedded in the aliaser script.