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

https://github.com/axelvazslima/bashrc-alias-manager

Unix .bashrc alias manager using Python.
https://github.com/axelvazslima/bashrc-alias-manager

python python3 unix unix-shell

Last synced: 10 months ago
JSON representation

Unix .bashrc alias manager using Python.

Awesome Lists containing this project

README

          

# Alias Manager

Alias Manager is a Python script that helps you efficiently manage command-line aliases in your `~/.bashrc` file. It organizes aliases into groups (e.g., Git commands, Docker commands, etc.), preventing duplication and ensuring better readability by maintaining an auto-generated section.

## Features

- **Group-based Alias Management**: Adds aliases in categorized sections.
- **Avoids Duplicates**: Ensures that existing aliases are not duplicated.
- **Auto-Generated Section**: Keeps aliases structured under a dedicated marker.
- **Interactive Menu**: Allows users to easily add, list, and create custom aliases.

## Installation

1. Clone this repository:
```sh
git clone https://github.com/yourusername/alias-manager.git
cd alias-manager
```

2. Make sure you have Python installed (Python 3 recommended).

3. Run the script:
```sh
python3 alias_manager.py
```

## Usage

When running the script, you will be presented with an interactive menu:

1. **Add aliases from predefined groups**: Choose from main commands, Git commands, and Docker commands.
2. **Create custom alias**: Define a new alias and command manually.
3. **List all aliases**: View existing aliases in `~/.bashrc`.
4. **Exit**: Quit the script.

### Example Alias Groups

#### Main Commands:
```sh
alias l='ls'
alias cl='clear'
```

#### Git Commands:
```sh
alias gst='git status'
alias ga='git add'
```

#### Docker Commands:
```sh
alias dps='docker ps'
alias dc='docker container'
```

## How It Works

- The script first checks for a special marker in `~/.bashrc`:
```sh
-----AUTO GENERATED BY AV PYTHON SCRIPT -----
```
- If the marker doesn’t exist, it adds one.
- When adding aliases, the script organizes them under sections like:
```sh
-----MAIN COMMANDS-----
alias l='ls'
alias cl='clear'
```
- Custom aliases can be manually added through the menu.

## Contributing

If you'd like to improve or extend this script, feel free to fork the repository and submit a pull request.

## License

This project is open-source and available under the MIT License.

## Author

Developed by me.