BerandaComputers and TechnologyTopalias: Open-source Python utility: aliases generator from shell history

Topalias: Open-source Python utility: aliases generator from shell history

Build Status
Test Status
Coverage
GitLab pipeline
Python Version
Downloads
Code style: black
Imports: isort
DeepSource

topalias – Linux bash/zsh alias generator and statistics from command history, written on Python.

Features

  • Generate short alias for popular command from bash/zsh shell history
  • Command history statistics & analytics
  • Parametrised input
  • Console help for all commands, options and arguments
  • Shell workflow hints

Installation

From pypi.org repository:

pip3 install -U --user topalias

From source:

git clone https://github.com/CSRedRat/topalias
python3 topalias/setup.py install --user

Run as python script without install:

git clone https://github.com/CSRedRat/topalias
python3 topalias/topalias/cli.py -h

Install requirements

sudo apt install python3 python3-pip -y

Add PATH environment variable for run Python tools as Linux utility:

echo "export PATH=$PATH: $HOME/.local/bin" >> ~/.bashrc
source ~/.bashrc

Usage

generated bash aliases

Syntax: topalias [OPTIONS] COMMAND [ARGUMENTS]

Without command utility check if you use alias in ~/.bash_aliases – analyze and print usage statistics, offers to find new simple aliases

python3 -m topalias  # run as python module
topalias  # check aliases and print suggestion bash command history
topalias -h  # print help
topalias --zsh  # work with zsh shell command history
topalias --min=2  # set minimal length for generated acronym filter, so that exclude some short command and find long, hard, usable command
topalias --debug history  # only analyze local bash history and print filtered rows

Files path search order:

  • directory from execution parameter
  • .bash_history in . current directory
  • .bash_history in ~ user home directory
  • example development files in topalias/data

You can change dot files search path to another user home directory:

topalias -f /home/user  # or topalias --path /home/user

Also you can use topalias utility in Bash for Git on Windows and in WSL.

TODO

  • multiline command in history
  • add any another acronym algorithm with semantic
  • more statistics & analytics (used dir, utils, parameters, time)
  • alias max length parameter

Please add you feature requests: https://github.com/CSRedRat/topalias/issues/new

License

GPLv3

Contributors

Thanks goes to these wonderful people (emoji key):

GitLab repository mirror with CI/CD: https://gitlab.com/CSRedRat/topalias

GitHub Pages: https://csredrat.github.io/topalias/

Read More

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments