Metadata-Version: 2.1
Name: alias-gen
Version: 0.6.5
Summary: Generate bash/zsh/fish shell aliases automatically.
License: MIT
Keywords: alias,bash,zsh,fish,shell,cli,command-line,command,completion,abbr,generate,terminal
Author: Ariel Frischer
Author-email: arielfrischer@gmail.com
Maintainer: Ariel Frischer
Maintainer-email: arielfrischer@gmail.com
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Description-Content-Type: text/markdown

# ALIAS-GEN 𑗊

![Screenshot](https://gitlab.com/ariel-frischer/alias-gen/-/raw/124474a794a16bbcaffe059a06a32e4064eb76d1/assets/screenshot.png)

Shell aliases are shortcuts or abbreviations for commands that are used in a Unix/Linux shell. They can save you time if you have very long or complex commands that you frequently use. ALIAS-GEN is a script that will create bash/zsh/fish shell aliases automatically to simplify your command-line tasks.

This script will create bash/zsh/fish shell aliases automatically. You can generate a new alias file by following the prompts, or use the `--stdout` option to print results directly in your terminal.

Two types of aliases are suggested, the default algorithm matches all characters incrementally for each command, while the `--use_min_alias` algorithm aims to minimize the total length of characters per command. 
Additionally, `--use_min_alias` does not necessarily match all characters in the command. 

The freq (frequency) column shows how often each command was used. For now, this script only generates aliases for the first word in a command. 
NOTE: Two character commands or less are not processed.

By default, fish shell generates abbr (abbreviations) rather than aliases.

## Requirements

- Python 3.6 or higher.
- No dependences required for installation.

## Install from pypi
```bash
pip install alias-gen
```
https://pypi.org/project/alias-gen/

## CLI Usage
Full Help Menu:
```
aliaser -h
```

Example usage to generate the top 40 aliases:

```
aliaser -n 40
```

With stdout and min_alias:

```
aliaser --stdout --use_min_alias
```

The `-s` argument specifies the shell type. In this example, `fish` shell is used.

```
aliaser -s fish
```

The `-f` argument allows you to specify a custom history file path.

```
aliaser -s zsh -f ~/.custom_zsh_history
```

## How does it work?

The `alias` column is generated by first sorting the most common commands found
in the history file, then aliases are generated for commands more than two
characters. These aliases just try to match character per character the given
command and will continue with more characters if there is a previous common
alias.

The `min_alias` column tries to minimize the total length of chars disregarding
the rule of matching the command character per character. It is generated using
the first char of the command always, followed by easy to reach keyboard characters
defined as QUERTY layout middle row, top row, then bottom row.

## Misc

I recommend using this script along with other shell plugins that help you remember
your alias or abbreviation. One example for fish shell is [fish-abbreviation-tips](https://github.com/gazorby/fish-abbreviation-tips).

## Buy me a coffee

Hope you found this project helpful, consider buying a coffee to show your support.

<a href="https://www.buymeacoffee.com/arielfrischer" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-orange.png" alt="Buy Me A Coffee" height="41" width="174"></a>



