Antiz96 / malias

An alias manager that allows you to easily add, delete or list your bash aliases in your ".bashrc" file by automating and securing every steps for you.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Malias

An alias manager that allows you to easily add, delete or list your bash aliases.

Table of contents

Description

An alias manager that allows you to easily add, delete or list your bash aliases in your ".bashrc" file by automating and securing every steps for you.

Installation

AUR

Arch Linux users can install the malias AUR package.

From Source

Download the archive of the latest stable release and extract it (alternatively, you can clone this repository via git).

To install malias, go into the extracted/cloned directory and run the following command:

sudo make install

To uninstall malias, go into the extracted/cloned directory and run the following command:

sudo make uninstall

Usage

The main menu

Run the malias command to open the main menu that will print every possible operations (add, list, delete, help, quit) followed by a short description.
From there, just type the the operation (or simply the first letter) you want to perform.

The add operation

The add operation allows you to add a new alias.
It will ask for the alias name and the command you want to associate it with.
For instance, in the alias ll='ls -l', ll would be the alias name and ls -l would be the command.
After filling in the requested information and giving the confirmation to proceed, the new alias will automatically be added to your .bashrc file (after being backuped).
Malias will then look for potential errors and apply the new alias or restore the .bashrc's backup (in case there's errors).

The list operation

The list operation prints the list of your current aliases.

The delete operation

The delete operation allows you to delete an alias.
It will print the list of your current aliases with a unique number in front of each aliases (like the list function does).
You must then type the number associated to the alias you want to delete and give the confirmation to proceed.
Once done, the selected alias will automatically be removed from your .bashrc file (after being backuped).
Malias will then look for potential errors and apply the deletion or restore the .bashrc's backup (in case there's errors).

Check the screenshots below for more information.

Screenshot

Run the malias command to open the main menu (also accessible with malias --menu or malias -m).

You can then type add (a for short) to add a new alias, list (l for short) to list your current aliases, delete (d for short) to delete an alias, help (h for short) to display the help or quit (q for short) to quit:

Malias-Menu

Alternatively, you can run the following commands to launch the associated function directly:
malias --add or malias -a to add an alias.
malias --list or malias -l to list your current aliases.
malias --delete or malias -d to delete an alias.
malias --help or malias -h to display the help.

To add an alias, type its name and then the command you want to associate it with.
The new alias can then be used right away.
Each step is automated and secured for you (with backup of your .bashrc file, error checking, backup restore if needed, etc...).
Example below with the alias list='ls -ltr', where list is the alias name and ls -ltr the command:

Malias-Add

The list function is self explanatory, it basically prints your current aliases like so:

Malias-List

To delete an alias, type the number associated to the alias you want to delete.
The deleted alias will then be gone right away.
Once again, each step is automated and secured for you (with backup of your .bashrc file, error checking, backup restore if needed, etc...)
Example below with the 31st alias (list='ls -ltr'), previously added in the "add" function example:

Malias-Delete

Documentation

Options:
  -m, --menu     Print a menu that lists possible operations to choose from (default operation)
  -a, --add      Add a new alias
  -l, --list     List all current aliases
  -d, --delete   Delete an existing alias
  -h, --help     Display this message and exit
  -V, --version  Display version information and exit

Exit Codes:
  0  OK
  1  Invalid option
  2  User didn't gave the confirmation to proceed
  3  An error occurred when creating/restoring the backup of the .bashrc file
  4  An error occurred when adding/removing the alias

For more information, see the malias(1) man page

Contributing

You can raise your issues, feedbacks and suggestions in the issues tab.
Pull requests are welcomed as well!

About

An alias manager that allows you to easily add, delete or list your bash aliases in your ".bashrc" file by automating and securing every steps for you.

License:GNU General Public License v3.0


Languages

Language:Shell 90.4%Language:Makefile 9.6%