cbf0a4e9781977e0240156df488b0d6aaa33f12a
Some checks failed
CI / test (push) Has been cancelled
Shell History Alias Generator
A CLI tool that analyzes your terminal command history to automatically discover frequently used long commands and generates shell aliases for them.
Features
- Multi-shell Support: Parse history from Bash, Zsh, and Fish shells
- Smart Analysis: Calculate frequency scores and identify commands worth aliasing
- Interactive Review: Review suggested aliases before adding them with a rich terminal UI
- Multi-format Export: Export to bashrc, zshrc, or fish formats
- Easy Installation: Direct installation to shell configuration files
Installation
pip install shell-history-alias-generator
Or from source:
git clone https://7000pct.gitea.bloupla.net/7000pctAUTO/shell-history-alias-generator.git
cd shell-history-alias-generator
pip install -e .
Usage
Analyze history and generate aliases
shell-alias-gen analyze
With a specific history file:
shell-alias-gen analyze ~/.bash_history --shell bash
Interactive mode
Review and select aliases interactively:
shell-alias-gen analyze --min-frequency 3
Export to file
shell-alias-gen analyze --export bash --output aliases.sh
Install directly to shell rc file
shell-alias-gen install --format bash
View supported shells
shell-alias-gen shells
Show history file locations
shell-alias-gen locations
Options
| Option | Description |
|---|---|
--shell |
Shell type: bash, zsh, fish, or auto |
--min-length |
Minimum command length (default: 15) |
--min-frequency |
Minimum command frequency (default: 2) |
--export |
Export format: bash, zsh, or fish |
--output |
Output file path for export |
--non-interactive |
Skip interactive review mode |
How It Works
- Parse History: Reads shell history files in shell-specific formats
- Analyze Commands: Counts command frequency and calculates complexity scores
- Generate Aliases: Creates short, meaningful alias names
- Review: Allows interactive review of suggested aliases
- Export: Outputs aliases in your shell's format
Alias Name Generation
Aliases are generated based on:
- First letters of command words (e.g.,
git checkout→gc) - Common keywords (e.g.,
docker,npm) - Minimum length and complexity requirements
Development
# Install in development mode
pip install -e ".[dev]"
# Run tests
pytest tests/ -v
# Lint with ruff
ruff check .
License
MIT License
Description
A CLI tool that analyzes terminal command history to discover frequently used long commands and generates shell aliases
Languages
Python
100%